viewdidload

Error: Mutating method sent to immutable object for NSMutableArray from JSON file

末鹿安然 提交于 2019-12-02 00:12:42
问题 This seems to be a fairly common problem, but the solutions that I have looked at do not solve the error. I am trying to read an NSMutableArray from a JSON file. Many of the suggestions I have seen involve using mutableCopy or [NSMutableArray arrayWithArray:] but both of these solutions do not fix the problem when using the call replaceObjectAtIndex:withObject: seen below. Please let me know if you have any advice on how to solve this problem. EDIT: I would also like to add that the inventory

Error: Mutating method sent to immutable object for NSMutableArray from JSON file

旧巷老猫 提交于 2019-12-01 20:41:07
This seems to be a fairly common problem, but the solutions that I have looked at do not solve the error. I am trying to read an NSMutableArray from a JSON file. Many of the suggestions I have seen involve using mutableCopy or [NSMutableArray arrayWithArray:] but both of these solutions do not fix the problem when using the call replaceObjectAtIndex:withObject: seen below. Please let me know if you have any advice on how to solve this problem. EDIT: I would also like to add that the inventory list is an NSMutableArray of NSMutableArray objects. The exact error reads: Terminating app due to

viewDidLoad being called before didSelectRowAtIndexPath

浪尽此生 提交于 2019-12-01 09:15:20
I have viewDidLoad (of next tableView) being called before didSelectRowAtIndexPath (of current tableView ). I am using a 'singleton' to hold my model and up to now this has been working quite well. I am trying to pass on the row selected in the current table in didSelectRowAtIndexPath to the destination tableview (they are linked by a segue in storyboard) by setting by the variable in didSelectRowAtIndexPath . However the viewDidLoad of the destination tableview is called before I can set the row number. didSelectRowAtIndexPath is called later but by then I have set up my data (wrongly) for

LandscapeOrientation on start of didload method in objective c

穿精又带淫゛_ 提交于 2019-12-01 06:34:58
I've made an iPad application, It works fine when I load my application in portrait mode for first time, but when I load my application in landscape mode for the first time, it takes the coordinates of portrait mode only, because inside my didLoad method I give coordinates of portrait mode only. Now need to give coordinates of landscape mode inside my didLoad method. I tried this, inside my didLoad method if (interfaceOrientation == UIInterfacePortraitmode || interfaceOrientation == UIInterfaceUpsideDown) { // do this.... } else { // do this.... } but I am unable to write the condition for the

LandscapeOrientation on start of didload method in objective c

心不动则不痛 提交于 2019-12-01 04:15:36
问题 I've made an iPad application, It works fine when I load my application in portrait mode for first time, but when I load my application in landscape mode for the first time, it takes the coordinates of portrait mode only, because inside my didLoad method I give coordinates of portrait mode only. Now need to give coordinates of landscape mode inside my didLoad method. I tried this, inside my didLoad method if (interfaceOrientation == UIInterfacePortraitmode || interfaceOrientation ==

viewDidLoad in iOS 6 called once?

对着背影说爱祢 提交于 2019-12-01 03:49:00
Head's up: This question is related to the recent deprecation of viewDidUnload . I have seen "great" and logical answers around this topic, but apparently they were proven wrong . Proceed with caution, this topic is very confusing as you see. From Apple's Docs: However, the system automatically releases these expensive resources when the view is not attached to a window. The remaining memory used by most views is small enough that it is not worth it for the system to automatically purge and recreate the view hierarchy. So... Can I safely assume in iOS 6 that, as long as I don't explicitly set

presentModalViewController in viewDidLoad on first launch

a 夏天 提交于 2019-12-01 03:16:44
I've been searching around but unfortunately have had no luck. My app requires the user to sign in/sign up the first time he or she launches the app. I know how to determine first launch (using NSUserDefaults) but whenever I try to present the modal containing the sign in/ sign up controls, nothing happens. Here's what I have: -(void)viewDidLoad { [self showLogin]; [super viewDidLoad]; } -(void)showLogin { FlipsideViewController *controller = [[FlipsideViewController alloc] initWithNibName:@"AccountView" bundle:nil]; controller.delegate = self; controller.modalTransitionStyle =

viewDidLoad in iOS 6 called once?

旧城冷巷雨未停 提交于 2019-11-30 23:56:07
问题 Head's up: This question is related to the recent deprecation of viewDidUnload. I have seen "great" and logical answers around this topic, but apparently they were proven wrong. Proceed with caution, this topic is very confusing as you see. From Apple's Docs: However, the system automatically releases these expensive resources when the view is not attached to a window. The remaining memory used by most views is small enough that it is not worth it for the system to automatically purge and

Is there an iOS method that fires when Autolayout has completed?

删除回忆录丶 提交于 2019-11-30 17:41:45
I have an iOS app in which I need to know when a new view is completely visible on-screen; that is, when Autolayout has finished its calculations and the view has finished drawing. ViewDidAppear seems to fire well before the view is completely visible. If I turn off Autolayout, the timing seems to line up as far as human perception goes, but I need to use Autolayout in this project (so this isn't a solution...just a test). Is there any method that fires when Autolayout is done calculating? Or another method that fires when the view is ACTUALLY visible (since ViewDidAppear doesn't work for this

How do I repeat a Reachability test until it works

点点圈 提交于 2019-11-30 16:14:02
问题 I have an initial tableviewcontroller which is executing a reachability check. This is working without a problem within the viewDidLoad , however I would like to know the correct way to Retry the connection until it passes. The pertinent code in my implementation file is below, I have tried inserting [self ViewDidLoad] if the connection is down but this just sets the app into a loop (returning the connection failure NSLog message) and not showing the UIAlertView . - (void)viewDidLoad { [super