A late-binding, message-based, object-oriented language that is a strict superset of C and is primarily used for programming on Apple's Mac OS X and iOS platforms. Objective-C can also be used on other platforms that support gcc or clang.

learn more… | top users | synonyms

5
votes
2answers
82 views

Simple 3…2…1 countdown in iOS app

I would like to display a 3...2...1 countdown on my iOS app (before to take a picture) but I didn't find an elegant solution. I don't want to make a Countdown app with an NSTimer. For me the important ...
5
votes
2answers
89 views

Consecutive Primes challenge at CodeEval.com and memory allocation issue

I finally solved this challenge with using recursion and figured out why the automatic scorer wasn't passing my previous solutions. I was using NSMutableArray to ...
1
vote
1answer
104 views

Consecutive Primes challenge at CodeEval.com

I am working through a new challenge on CodeEval.com and I think I am getting a correct result but I can't get through their grader. I am not exactly sure where error is. I didn't post this on stack ...
2
votes
1answer
54 views

BaseTableViewController with pull to refresh and auto load more

I've implemented a table view controller for the purposes of subclassing. The table view controller implements a pull-to-refresh which will automatically reload the table view's data. I am looking ...
0
votes
0answers
56 views

Unit testing - Parsing data from the Weather Underground API

I'm writing unit tests for the first time. The tests are for my library on Github. I downloaded the JSON and stored it into a local file that looks like this: ...
5
votes
1answer
65 views

Find the next 7 o'clock NSDate

In my very specific scenario, I need to get an NSDate holding the next time the hour will be 7 (either AM or PM). On the case that this is the first time to do ...
2
votes
2answers
111 views

Creating an iOS form with many similar text field cells

I'm using multiple instances of an object creating a form: ...
3
votes
1answer
81 views

Retrieving values from UITableViewCell

I have a UITableview with custom cells, every cell has a button called cellButton. When the user taps the button I present an ...
7
votes
1answer
118 views

Localization manager based on ReactiveCocoa

I have a localization manager class which can change app language on the fly. It's using ReactiveCocoa and my main concern is that I'm not using some of RAC parts correctly. First (in ...
12
votes
4answers
549 views

Generating an ordinal number for the day of the month

I am relatively new to programming and came across an if statement that I believe to be a bit verbose. I have tested my code and it appears to work without any ...
5
votes
1answer
89 views

Creating and saving blurred screenshots in iOS

I am trying to create a class that takes a screenshot of the screen, makes it blurry and saves it to NSUserDefaults. ...
5
votes
1answer
123 views

Caching data on disk in iOS

I've got an app that's got an activity/timeline like view. Since I don't want to retrieve the entire timeline every time, I'm caching all the events. Currently, this is how I go about it: ...
0
votes
1answer
102 views

Singletons and subclassing - new design needed [closed]

Half a year ago, I created a singleton-class that is used as a communication with another device. I then got the idea that a demo-mode would be great, so against better knowing I subclassed the ...
0
votes
1answer
50 views

Handling button behaviour [closed]

I have an iOS app where I use some buttons for different things, but I'm repeating a lot. For buttons pressed: ...
3
votes
1answer
60 views

URL-finder using a lot of memory

I'm trying to get the URL of the browser with Mac OS X app. I wrote some AppleScript and am trying to use it in Cocoa. The problem is, when I watch it with instruments, memory is increasing, and at ...
6
votes
0answers
57 views

BiDirectional Dictionary (and its Mutable friend can come too)

I've attempted to implement a 1-to-1 dictionary in Objective-C. I'm probably missing some convenient methods that one might commonly want to use. These are both declared in the same ...
4
votes
1answer
90 views

Truncate 160-bit output from SHA-1 to 64-bit uint64_t

I'd like to truncate 160-bit output from SHA-1 to receive a (weaker) 64-bit digest. It has been a while since I did the type of low-level C pointer arithmetic in the but-last line. Could you please ...
7
votes
0answers
56 views

Brute Force (and not) Bejeweled AI

My approach to solving the problem of selecting the best match on a bejeweled board is a fully object oriented approach. Some of the other relevant code can be found in my previous questions ...
3
votes
1answer
117 views

Animated Score Amounts for Game

This is a simple class for a label with a score that animates counting up or down. When someone in the game scores points, the numbers count up or down to the new total. Here is an example of what ...
5
votes
1answer
55 views

Unit Testing Bejeweled Wilds

I created a pretty complex algorithm for calculating matches on a Bejeweled board that kept track of matches involving wilds. After doing some in-game testing, I found quite a few bugs that needed to ...
10
votes
1answer
174 views

Changing image of a UIImageView based on a scrollView contentOffset

My task is pretty simple and my code works, it's just that my code feels a bit clumsy to me (and probably will for you too). I have a view controller (...
3
votes
1answer
298 views

Using NSPredicate with NSFetchRequest in a NSFetchedResultsController

I am learning CoreData and I wanted to have my code reviewed. As usual, I get something to work, then I attempt to refine it. I have a data model that consists of an Item entity and a subItem entity. ...
11
votes
1answer
101 views

Bedazzling My Bejeweled Animations

I've spent a few days working on the animations for my Bejeweled clone and I am pretty happy with the results so I am posting the code for review. This is the most advanced animation code that I have ...
3
votes
1answer
56 views

Store CMTimeRange into Core Data

I wanted to store CMTimeRange structures inside managed objects, so I've worked out the following: ...
3
votes
1answer
73 views

HMSegmentedControl react to tapping on currently selected segment

I'm using HMSegmentedControl, an open-source UISegmentedControl subclass. I'm trying to react to the user tapping on the currently selected segment. HMSegmentedControl only supports reacting to a ...
4
votes
0answers
127 views

Switching between view controllers that are loaded in the background

I have a dining menu app that scrapes the data from a website and redisplays it in a mobile format, displayed below: If the user swipes left and right, the app will show the previous/next meal (ex. ...
10
votes
2answers
155 views

Refilling a Bejeweled Board

When you start thinking about designing a Match 3 type game, you realize that there are a great many ways to structure the rules. In this particular variant, the direction that the player swipes the ...
12
votes
2answers
204 views

LinkedList (doubly) implementation

CKLinkedList is the implementation of a doubly linked list. I'd like to see comments on the memory management (I'm using ARC in the code below) and formatting + ...
12
votes
1answer
64 views

Board Evaluator for Bejeweled Clone

I've been prototyping a Match 3 game (Bejeweled clone) because I have an interesting concept for one, and because it is good practice. One key aspect of my version is that the matches must contain ...
4
votes
2answers
67 views

Saving Separate User Profiles

I am modularizing some of my code in order to make it reusable in future projects. The latest thing that I have created is a simple class that saves user profiles. The list of profiles is loaded ...
6
votes
2answers
414 views

Segue between view controllers using NIB files

I'm learning how to develop for iOS and I want to begin with nib's before storyboard to get a better understanding. I just set up 3 view controllers: ...
5
votes
0answers
69 views

“The Ministry Of Truth” challenge at CodeEval.com

I am working on another challenge from CodeEval.com and this is a bit harder. I would like to get some feedback on my logic of solving the challenge. Also there is probably one edge case that I ...
5
votes
1answer
81 views

Reverse Groups challenge at CodeEval.com

I am working through challenges at CodeEval.com and wanted to get your input on my code for this challenge. Given a list of numbers and a positive integer k, reverse the elements of the list, k ...
1
vote
2answers
70 views

Archiving data in file system for iOS

Being my first time archiving data to the file system, I would like to have my code reviewed. This simple test project works as expected, but I want to see if what I am doing is following best ...
8
votes
2answers
85 views

Simon's Opposites Game

I cooked up this little game today for the community challenge mentioned here. The idea of the game is that sometimes when Simon gives you a color, you should choose the opposite color (the color in ...
6
votes
4answers
127 views

Obj-C wrapper for OpenLDAP

This section of code reside in a utility class (LDAPUtility). It's purpose is to subscribe or unsubscribe a user from an LDAP group. My main questions are if I am using the LDAP library correctly and ...
4
votes
2answers
143 views

MD5 Brute Force Algorithm

I am coding an Objective-C MD5 hash "decrypter". Since you cannot decrypt such a hash function, I am approaching it with a brute force algorithm, that tries every single password combination until it ...
4
votes
2answers
105 views

NSAssert or NSLog in defaults switch case

I am wondering if I should use NSLog(@"Switch out of range") or NSAssert(FALSE,@"Switch out of range"); in the following ...
5
votes
2answers
72 views

Consecutive animations

I'm new to Core Animations, I want to fade out two different layers one after another.I write them in a CATransaction block. I wonder if there is better approach to make such animations. ...
4
votes
3answers
93 views

Unit Testing for a Complex Game

I have known about unit testing for a while now, but I am just now finally understanding how to implement it. I think that my initial implementation is a little rough so I could use some feedback. ...
2
votes
1answer
505 views

Updating UITableView rows from Core Data

I am fetching or querying all the entries from my database (core-data) at three different times in my code, which I find to be an inefficient approach to writing the code. The method ...
6
votes
1answer
128 views

Creating view rects in loop

I don't use constraints or IB to create views so it's easier to create rects this way. Does it wrong totaly? ...
4
votes
2answers
138 views

Bats Challenge from CodeEval.com

I am going through coding challenges and I would like to get feedback on one of them. I am not sure if i can post the link to the challenge but here it is. CodeEval Challenge Outside of your ...
4
votes
2answers
94 views

Setting a common background image on a dozen screens

Is there something as "they have too little in common to use a superclass"? In my case, doing iOS programming, in a project, every screen has the same background. So I created a superclass which only ...
4
votes
2answers
118 views

Fetch plist file

I have a plist file with many nested dictionaries inside of it, and I wanna fetch them all to my code. Isn't there any more efficient way to do that than nested for-loops? ...
3
votes
0answers
161 views

UIScrollView Category utility function for auto sizing contentSize

I wanted a utility function on UIScrollView to automatically size the contentSize based on the content inside the scrollView. How is this? ...
10
votes
3answers
139 views

BOOL declaration

I have an if statement which compares two NSString. If the two strings are equal, I assign the 'YES' value to a ...
3
votes
1answer
186 views

Error-handling #ifdefs for AFNetworking requests

I am using AFNetworking 1.4.3 to send and receive network messages in iOS. My application works slightly differently in DEBUG and RELEASE mode, so I need to use ...
2
votes
1answer
1k views

Implementing NSCopying and copyWithZone

I've read some resources on implementing NSCopying and copyWithZone, but things are still not very clear. I see many ...
5
votes
2answers
70 views

Finding the Greatest Integer and Ties

I'm trying to find the greatest integer of four integers and its ties. I used the following code. Is there anyway to simplify this more effectively? ...