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
1answer
78 views
+100

Generic singleton array with archiving and insertion functions

I find that I often have to maintain a singleton primarily to hold an array that is sometimes persisted between user sessions, that should have only one class of items, and that sometimes needs to be ...
3
votes
1answer
63 views

Amanda's Relationship Tips app, with scroll performance issues

I am having some major issues with scrolling in my active app "Amanda's Relationship Tips" Under the User Advice tab: I'm using the Parse Database as a backend to pull user data. This lag is ...
3
votes
1answer
105 views

NSUser defaults cellForRowAtIndexPath

I have been going back and forth on one certain part of my code. It works, but it doesn't seem right for some reason, as I believe there must be an easier/cleaner way to implement the ...
1
vote
1answer
67 views

Using nested if statements to select textfield for update of associated label

So I have written a very simple program using a cocoa pods library to calculate the distance between different cities. Here is what the UI looks like: So I have a textfield on top for entry of ...
6
votes
1answer
129 views

Ensuring non-expired token before every request

I'm developing an iOS application where data is fetched from a third-party REST API. Each request must contain an authorization token. In order to implement this, I've written a ...
6
votes
1answer
145 views

Unity3D native iOS plug-in to read pedometer data

I've made a plug-in for Unity3d for iOS. The plug-in's job is to get the Pedometer data from history within a specified period of time and return that to Unity for later use. I am confident in my C# ...
5
votes
1answer
42 views

Simple plotting abstract base class and example subclass

I came across a CocoaControl ZFPlot and wanted to extend here. I ended up writing a base class (ZFPlot shown below) as well as several extensions (ZFLine, ZFScatter, ZFBar, none shown here for ...
3
votes
1answer
68 views

Downloading and parsing data

I developed this class to download a JSON from a server, parse the result and call a delegate back on the class that called it. Since I am self started I want to know if this is a good practise. ...
3
votes
0answers
82 views

Algorithm for downloading images

I am working on a product application where user could sell/buy. This application is based on collection view. Collection view has collection cell where it displays product image thumbnail. The ...
3
votes
1answer
57 views

Creating a class which has a method running every frame

I’m working in Objective-C, SKSpriteKit and am trying to create a class which will work in both OS X and iOS for flexibility. ...
2
votes
1answer
51 views

Have I created the <mutableDeepCopying> protocol properly?

I’m working in Objective-C, SKSpriteKit and am trying to create a class which will work in both OS X and iOS for flexibility. I have just created a new protocol for my programs: ...
2
votes
0answers
42 views

Quartz2D, circular slider performance optimization

I have a circular slider. Each time i move finger i call [self setNeedDisplay], get new angle to change handle position and mask arc. When i move very fast my CPU load about 70%, it's very hight as ...
2
votes
2answers
60 views

Method for finding all classes

This was inspired by a Stack Overflow question about getting all the classes of an application and I took it a little too seriously (or perhaps not seriously enough). It's rather silly to do it this ...
1
vote
0answers
119 views

Synchronize access to instance method using static serial queue

In my current project I have a number of data services classes, each one dedicated to a specific source of data so that it's responsible of downloading data from its api, checking for local database ...
5
votes
1answer
71 views

Optimise Code for KukuKube Game

I developed a Kuku Kube game for iOS. Each time I choose a correct different color tile, it will increase a number of tile quantity 2x2 3x3...10x10. How to optimise the code each time the tile ...
0
votes
4answers
495 views

My own method for sorting numbers in array

I've written some method for sorting asc and desc numbers in array. All I want to know is this good logic, and is there a space for improving this code? ...
5
votes
1answer
138 views

Repeatedly check URL for change on iOS

I am wanting to constantly check a URL http://www.example.co.uk/untitled.php which will either return 1 or ...
-1
votes
1answer
138 views

Reading QR Code

What I need to accomplish is matching the QR code to the one I have created. This code works, except it takes at least 30 seconds to verify that it has matched my QR Code. How can I make it faster? ...
10
votes
1answer
128 views

Blurring an Image

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
8
votes
2answers
265 views

iOS Utility methods for UIView

Lately, I've been part of a team working on a utility library for iOS called Thundercats (on Github). We're about to start working on some changes and upgrades in preparation for a 2.0 release, so we ...
3
votes
2answers
134 views

Find all multiples of a number in given range in reverse order

I have a problem set which requires me to print all the multiples of a number in given range in reverse order. So far I have tried this but not sure it is optimized or not! ...
-1
votes
2answers
284 views

Quicksort for Objective-C

This is quite plain vanilla, but I'm hoping for Objective-C specific feedback. Also I'd be interested in what folks think about sorting in Objective-C vs. doing all sorting in C or C++ (and which?) ...
7
votes
1answer
60 views

Draw editable angles

One of the first things I did when I learned Objective-C was to create a little canvas with editable angles. Basically, you tap to create points. Every tap connects to the previous tap. So if you tap ...
4
votes
1answer
87 views

Imitate UITableView reordering interaction

I have a UIScrollView full of vertically stacked subviews which I want the user to rearrange as they desire. I've implemented a ...
11
votes
1answer
99 views

Top wiki pages as an app

I recently did an interview task. I was rejected because of bad code quality. There was two tasks. Here I will present the first, second will be posted in time. This project is avalible on GitHub ...
2
votes
2answers
104 views

Getting hours during the day

I have this method that returns an array of all the hours for the past 24 hours, ex: if the current time is 3:24pm it looks like @[3pm,4pm...12am,1am...2pm,3pm]; ...
2
votes
1answer
94 views

Intercept URL containing values or not

I need to intercept a URL and go outside the WebView if the URL contains MAPS or DOCUMENTS ...
5
votes
1answer
223 views

Fetching Background Data in iOS View Controller

I am trying to come up with a way to fetch the same data both when the application is running and when it is in the background. The code I have written so far works... I just think it is very messy ...
3
votes
2answers
68 views

Comparing IDs in two arrays

I have two arrays that I need to compare if their IDs are equal. This is how I am currently doing it: ...
7
votes
1answer
86 views

Comparing 2 arrays of dictionaries and saving user preferences

I will start by explaining the situation and then show some code. I have an app that has an array of "default" settings to display on a user's dashboard. The user can modify these settings to enable ...
7
votes
2answers
377 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
241 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
183 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
429 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
198 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: ...
6
votes
1answer
204 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
637 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
370 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
199 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
769 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
171 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
937 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: ...
3
votes
1answer
78 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 ...
9
votes
1answer
122 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
135 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 ...
8
votes
1answer
132 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
530 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
62 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
842 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
2k 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. ...