Tagged Questions

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

4
votes
2answers
37 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
48 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
72 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
63 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
77 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
70 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
64 views

Too little in common to use superclass?

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
73 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
49 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
92 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
69 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
63 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
62 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? ...
4
votes
0answers
56 views

Saving bytes instead of objects to write smaller files

This question is about reducing the size of files saved to disk in an infinite world 2D mining game. I finally added code to my game to save and load distant chunks instead of keeping all of them ...
5
votes
2answers
58 views

Solving first- and second-degree degree polynomials

I was writing a bit of code and I was just wondering if I was doing it the right way. I know all the syntax is right and It all works perfectly. I was just wondering if I'm doing it the right way. ...
1
vote
1answer
51 views

Correct Implementation of Custom UIView into ViewController Programatically

I am familiar with using scoreboards to construct UI elements in Xcode, but I am only beginning to learn how to make UI programmatically (with out storyboard). I wanted to know if this is the correct ...
3
votes
1answer
225 views

Generic class for displaying UIAlertView / UIAlertController on iOS

To address backwards compatibility for UIAlertView, I have come up with an interface that would seem to work for both iOS ...
4
votes
1answer
64 views

Dirty but Efficient Texture Atlas in Spritekit

I have spent quite a bit of time trying to optimize the performance of my 2D mining game. After a lot of research, experimentation, and testing, I finally found something very interesting that ...
5
votes
1answer
93 views

My iPod is slower than my iPad

Many of the variables in my 2D mining game were declared as constants like so: DWConstants.h ...
3
votes
1answer
62 views

Non-concurrent write creates bottleneck

I have some efficient methods that recursively creates a tree structure (NSTreeNode) of by looping recursively over a directory structure. The result is displayed ...
5
votes
0answers
54 views

Multithreading in a 2D Mining Game

I have implemented some basic multithreading in my 2D mining game that I asked about in a previous question. The first part is working out great (creating the initial object instances in the ...
3
votes
5answers
123 views

Turning JSON objects into custom NSObjects

Was advised to post this question here after posting to Stack Overflow. I'm pre-populating a UITableView app with data using a local JSON file. The JSON itself is very simple: ...
1
vote
0answers
22 views

Is this an acceptable way to map JSON objects to custom NSObjects? [duplicate]

I'm pre-populating a UITableView app with data using a local JSON file. The JSON itself is very simple: ...
8
votes
1answer
83 views

Chunk Loader for 2D Mining Game

I've spent a couple days on my latest project, and I believe that I have achieved a sufficient level of efficiency to post it here for review. The idea of the game is to mine out an "infinite" world ...
3
votes
3answers
115 views

Speeding up storage of about 220000 values in Core Data

I use this code on the app's first run to save about 220000 values into core data. The file Navaids.txt has about 200000 and Waypoints.txt has about 20000 lines, where I get data from each line and ...
1
vote
1answer
53 views

Reading a property on a main thread that is set on a background thread

I am currently handling some setup of an object on a background thread (I am using a concurrent queue within the following initWithDocumentFileURL method): ...
5
votes
0answers
52 views

Modularizing a Game Scene in Sprite Kit

I am trying to modularize the main SKScene of my strategy game. I am not sure that my approach is correct so I would love to get a review of the following code. The SKScene adds the top level node of ...
3
votes
0answers
106 views

Core Data model for test-taking iOS app

I'm building an iOS app for test-taking and I want to be sure of my model before proceeding. I found this post very helpful and tried to implement a simplified version for Core Data. Here are some ...
4
votes
1answer
92 views

Reading and Parsing JSON from a Game Server

This is my naive (but currently working) attempt at reading JSON commands from a Java game server in Objective-C. I am afraid I might be doing something wrong, so hopefully this question will be a ...
3
votes
3answers
329 views

Determine if a string has all unique characters

I'm practicing algorithms (for future interviews) while learning about Big O notation and was wondering if there's a faster or more optimal way of writing an algorithm to see if a string has all ...
1
vote
2answers
191 views

Repurposing UITableView infinite scroll configuration/properties

Had my first go at implementing infinite scrolling for UITableView's in my iOS app last night, and I noticed I ended up copying/pasting quite a bit of boilerplate from one VC to the next (if I wanted ...
3
votes
1answer
53 views

Factory Class for Game World

The world in my strategy game is comprised of a number of towers. At the start of the game, only one tower is generated, and when the player discovers new towers they are created and added to the ...
3
votes
1answer
56 views

Complex Conditionals in a Strategy Game

I have been looking at this method for a long time and I have finally refactored it into something that I believe is much more readable. I am not totally happy with it though so I would like to get ...
6
votes
2answers
200 views

Array from file

I have this code which is performed each time I click the 'show polygons' button. The problem is that it takes a few seconds to finish running through the code before actually drawing the polygons + ...
10
votes
4answers
571 views

Prime Factorization

I'm doing an Objective-C project and I need to do some prime factorization and so I came up with the following algorithm which is 99% C, except for the array part which was easiest to implement in ...
0
votes
1answer
62 views

Making a webService file smaller [closed]

I'm developing an iOS app, and I have a file, WebService.m, that is now 2300 lines long. My file contains all the web service calls on my app, with their parsing if successful, like: ...
3
votes
2answers
108 views

Keeping UI code DRY in iOS projects

I've subclassed UI button and used it in my View Controller's viewDidLoad method, like so: ...
3
votes
1answer
103 views

Loop Animation on several UIButton's NSLayoutConstraint

I took the belated plunge to look at Autolayout. Normally I'd animate based on a UIView's frame (i.e I'd have used the following): ...
3
votes
2answers
133 views

Thread-safe, in-memory LRU cache with a maximum item count of 10

I'm attempting to master LRU Caching. It must be thread safe, and it should preferably perform as well as web image-cache, (avg ~1MB). Please take a look to see if there's anything wrong, amiss, ...
4
votes
2answers
75 views

Should this Method be in TableViewCell or ViewController?

I have a custom tableview cell for displaying different foods, with a star next to each name. If the food has been favorited (i.e., it exists in the database), the star is filled in, otherwise it is ...
4
votes
1answer
50 views

Model class for networking that uses notifications

I just finished a model class that represents an Instagram Networking client for my iOS app. I am specifically looking for a review of my use of static constants. These are strings that represent ...
6
votes
1answer
163 views

Clustering markers on Google map on zoom

I have a method that is getting called when someone zooms camera on the map (Google map). I recalculate the positions of markers of map and the code is clunky and not effective. I iterate over arrays ...
5
votes
2answers
170 views

Directory listing model

I need a class to read and store directory structure. This is my first step in Objective C so I ask to you to say what you think. Header file: ...
11
votes
3answers
277 views

Using a Dictionary to retrieve BOOL values

I have some values pulled from a web service giving me a bool value for a key. I did it this way, but feel like it is repeating without need. How can I refactor this? Please note that the key on ...
6
votes
1answer
84 views

API for SQLConnect Library

I've designed a library for connecting Objective-C (and now Swift) apps to Microsoft SQL Server 2005+. (I believe there are other databases it works with, but I've only tested with MSSQL.) The ...
3
votes
2answers
45 views

Further refactored Model class that represents a calculator

Here is my Model class's new header file: ...
4
votes
3answers
78 views

Model class representing a calculator

I have a simple Model class that represents a calculator. Here is it's header file: ...
4
votes
1answer
72 views

Downloading and Loading Remote Game Assets

On advice from an answer to my previous question, I have written some code that will allow my game balance properties to be loaded from a remote server. Right now I am just hosting the raw property ...
3
votes
1answer
52 views

Game Balance and where to store Variables

I have been thinking about this aspect of my game for a little while, and I have come up with the following solution. I am sure that there are problems with the way I have implemented it so any kind ...
-1
votes
3answers
191 views

iOS coding style

I am new to iOS development. I wrote this code, but the company said that this is bad architecture and is not acceptable. I want to improve this code. ...