trapper
  • Member for 5 years, 7 months
  • Last seen more than 1 year ago
Initiating Child ViewController from UIStoryBoard in iOS
1 votes

There isn't another way to handle this scenario. Storyboard VC's can't be subclassed without replicating the UI also. I'm surprised this works at all. object_setClass just changes the isa pointer, so ...

View answer
Multiple AFNetworking calls In a view controller
1 votes

There is nothing wrong with multiple network requests, it will not have any impact on battery that you need to worry about. Your code however needs a lot of work. None of these network requests ...

View answer
Populate TableView with JSON data
1 votes

Firstly ListViewController does not need to know where the List comes from. Use dependency injection here, so set up List and inject it into ListViewController before it gets presented. Now why not ...

View answer
Updating images in a weather app
1 votes

You need to do a few things to clean this up. Move this logic out of the VC and into a model object. Get rid of string comparisons, so convert to a number and use switch() All these magic numbers are ...

View answer
Initializing a big static array for a card-based iOS app
1 votes

Put all this static data into a .plist file. Now you can cleanly maintain that seperate from your source code, and easily suck the whole thing in as needed. NSString *path = [NSBundle.mainBundle ...

View answer
Sychronous wrapper around UIApplication.openURL:options:completion:
0 votes

You don't need to do anything special here. Just change to the new method and ignore the completion handler. [application openURL:url options:@{} completionHandler:nil];

View answer
Checking for required text fields for login
0 votes

A better solution may be to just disable the login button until all fields are filled. However if you want to stick to this alert the error approach then move this logic out of the VC and into your ...

View answer
Objective-C and AFNetworking
Accepted answer
0 votes

Don't pass 'params' in via a public method. What are these params? Make the method signature explicit. So instead of + (void)loginParams:(NSDictionary *)params success:(SuccessBlock)success failure:(...

View answer
Checking for many alertable conditions before saving customer information
0 votes

Move all this service logic out of your VC and just use NSError to pass failure messages back to the user. - (IBAction)saveCustomer:(id)sender { NSError *error; if (![self.service canSave:&...

View answer
Up/down arrow key commands
0 votes

Don't be too concerned about the 'shortest' solution. What you want is clean code that makes sense. So first get rid of all those magic numbers and use enumerated constants. Now change the if/else ...

View answer
Optimizing UITableViewCell with singleton property
Accepted answer
0 votes

Omg a lowly TableViewCell does not tell a NavigationController what to do! Give your cell delegate methods like productCell:didTapEditButton: and set your VC as the cell delegate. Now the cell is ...

View answer
Method to check if TicTacToe board has a winner
0 votes

Instead of checking if (sum == -3 || sum == 3) which you repeatedly do you can check abs(sum) == 3

View answer