Tagged Questions
-1
votes
1answer
52 views
How can I improve below Objective-C code to tint an image?
I have an image which is a black ring:
In my view, I need to display it as a white ring. So, to tint the image, I have written the below method:
- (UIImage *)getRingImage
{
UIImage *ringImage ...
1
vote
1answer
238 views
Data model code review for iOS app
I'm new to iOS development and I'm having trouble figuring out how to efficiently load my app's data at launch time. My app consists of a UITableView that is populated with a list of songs. Each cell ...
1
vote
1answer
126 views
Testing the same code with different input data
I would like to get an advice regarding how to test the same code with different input data.
I would like to test that method operationSucceeded will be invoked for all successful status codes. Here ...
4
votes
2answers
138 views
Am I reconstructing the buffers correctly
I am writing a networked audio application that sends the audio in 320 byte chunks, later I need to provide the player a bigger amount of bytes to play so I try to merge 2 or more chunks into one ...
1
vote
1answer
49 views
A structure and helper functions for working with polar coordinates
Cross posting from Stack Overflow (not sure how to more correctly cross-post).
This started simple, as most things do...
I just wanted a little structure to hold polar coordinates for a totally minor ...
1
vote
2answers
105 views
iOS/Objective-C “if” best practice
I've got this code that I found in a project and I'm wondering how can it be done better:
- (void) setAlpha:(float)alpha {
if (self.superview.tag == noDisableVerticalScrollTag) {
if ...
0
votes
1answer
59 views
Is there a more optimal way to write the following encoding and then assign the result to a label?
Is there a more optimal (or concise) way to write the following:
I have to do some encoding and then assign the result to a label.
// encoding fix
NSString *correctStringTitle = [NSString ...
1
vote
1answer
36 views
A better approach to coding the a string value test for a NSDictionary object
My conditional code here seems repetitive and long. Is there a better approach? I want to test for a string value in a NSDictionary object and then depending upon the value prefix a UILabel with $, £, ...
0
votes
2answers
120 views
Optimizing iOS method in objective-c
I have such method and have a hard time optimizing it to run better. It takes roughly 1 sec with 100 units to get between NSLog(@"Debug2") and NSLog(@"Debug3"). And 2 sec on iPhone.
Method idea:
...
0
votes
2answers
339 views
iOS View Controllers - Default Lazy Loaded Properties (Tab Bar Item & Navigation Item)
It is a little thing about UIViewController, but it has always bothered me - the boilerplate code needed to setup some of a view controller's default properties (e.g. the tab bar item and navigation ...
1
vote
2answers
85 views
Need an Obj-c code review for core data implementation
I'm just beginning my foray into iOS development and need a code review. I have a custom NSManagedObject that needs some smart setters. New to obj-c, iOS, and core-data development, I don't trust ...
1
vote
1answer
98 views
Initialize a bunch of NSDateComponents objects at once (in a loop)?
I'm developing an iPhone app that is heavily Calendar-based, and it requires a good amount of (what I'm calling) "date boundaries."
I use these "date boundaries" to fetch EKEvents from specific ...
1
vote
1answer
82 views
Rot47 an NSString Category
As a JAVA native, i am always a litle worried when doing objective-c... memory leaks and pointers flying at my head...
All comments are welcome on the Category below, the Category functions are ...
3
votes
2answers
1k views
Dependency Inversion / Injection? - Networking code in model classes
@implementation User
- (void)refreshProperties
{
assert(!self.isSyncing);
NetworkOperation *op = [[NetworkOperation alloc] initWithEndPoint:GetUserDetails parameters:nil];
[self ...
1
vote
1answer
134 views
iOS UITableView; saving cell checkmarks to disk
As per suggestion on SO, I am posting my code here to be reviewed. It was said I should not be saving and reading from disk so many times when a user selects and deselects a cell in my tableView.
...