cocoa-touch

pop a specific view controller

寵の児 提交于 2020-01-17 01:05:35
问题 I have an hierarchy of 3 view controllers in my navigation bar controller: view1->view2->view3. After the user finished with view3 I want to take him to view1. What is the best approach to do that? thanks, Nava 回答1: Assuming that view3 and view2 have already been pushed onto your navigation controller, you can use -[UINavigationController popToRootViewControllerAnimated:] or -[UINavigationController popToViewController:animated:] to accomplish this. 回答2: Simply make the action of a

pop a specific view controller

不想你离开。 提交于 2020-01-17 01:04:13
问题 I have an hierarchy of 3 view controllers in my navigation bar controller: view1->view2->view3. After the user finished with view3 I want to take him to view1. What is the best approach to do that? thanks, Nava 回答1: Assuming that view3 and view2 have already been pushed onto your navigation controller, you can use -[UINavigationController popToRootViewControllerAnimated:] or -[UINavigationController popToViewController:animated:] to accomplish this. 回答2: Simply make the action of a

Why can a weak member be nulled in an instance method before the method is finished?

只愿长相守 提交于 2020-01-16 19:15:34
问题 And why can it vary between Debug/Release/Simulator/Device combinations? (Sample code below.) I inherited some code that "works" in the simulator and on devices in Debug, but not on a device in Release (used to with last LLVM). It's related to ARC and a weak property (which should have been strong), but I don't understand fully what's happening and am hoping someone can explain it to me and why it varies between Debug/Release/Device/Simulator. I created a simple sample project that

iOS special characters, strange issue

允我心安 提交于 2020-01-16 18:18:14
问题 I've got a very strange issue. I started an iOS App about three years ago (iOS-SDK 3.0), and since then went through the SDKs 4.0 and 5.0. Since 5.0 (or maybe 5.1) I suddenly started having problems with German special chars (ä ö ü ß). Now I can't even initialize an NSString with special chars, this line: NSString *str = @"abcäxyz"; gives the following warning: Input conversion stopped due to an input byte that does not belong to the input codeset UTF-8 And this one: NSLog(@"%@", strTemp);

iOS special characters, strange issue

我的梦境 提交于 2020-01-16 18:18:13
问题 I've got a very strange issue. I started an iOS App about three years ago (iOS-SDK 3.0), and since then went through the SDKs 4.0 and 5.0. Since 5.0 (or maybe 5.1) I suddenly started having problems with German special chars (ä ö ü ß). Now I can't even initialize an NSString with special chars, this line: NSString *str = @"abcäxyz"; gives the following warning: Input conversion stopped due to an input byte that does not belong to the input codeset UTF-8 And this one: NSLog(@"%@", strTemp);

iPhone “touchesBegan” and “touchesMoved” message … do not move to centre of touch

泄露秘密 提交于 2020-01-16 16:16:31
问题 I am modifying the "MoveMe" example from the apple web site. When my controller gets the "touchesMoved" message it moves the object being moved to the centre of the touch, because (pseudocode) object.center = touch.center. How can I store the offset of the initial touch so that if I start the touch/drag to the side my finger will stay on that spot while I drag it around? 回答1: You can store target_view.frame in an instance variable when touchBegan message arrives. 回答2: Can't you store that in

iPhone “touchesBegan” and “touchesMoved” message … do not move to centre of touch

五迷三道 提交于 2020-01-16 16:15:39
问题 I am modifying the "MoveMe" example from the apple web site. When my controller gets the "touchesMoved" message it moves the object being moved to the centre of the touch, because (pseudocode) object.center = touch.center. How can I store the offset of the initial touch so that if I start the touch/drag to the side my finger will stay on that spot while I drag it around? 回答1: You can store target_view.frame in an instance variable when touchBegan message arrives. 回答2: Can't you store that in

Three-pane split view interface on iPad landscape mode

女生的网名这么多〃 提交于 2020-01-16 10:55:12
问题 iOS Notes and Mail apps have a three-pane split view interface on iPad landscape mode. How can I create such interface? I checked UISplitViewController but it made only two panes (master and detail). Can somebody please enlighten me how to create the leftmost pane? 回答1: It's done using custom layout. You have root view controller that loads three other view controllers into three container views. That is all. 来源: https://stackoverflow.com/questions/47956490/three-pane-split-view-interface-on

iOS 8. Change app badge number without any notifications

回眸只為那壹抹淺笑 提交于 2020-01-16 10:49:08
问题 In my app I need to set badge onto the app icon and set numbers for this badge. The problem is that I need to register user notification settings like this: if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) { [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil]]; } in order to make it work on iOS8. If I run this code then on start

How do I ensure my DispatchQueue executes some code on the main thread specifically?

对着背影说爱祢 提交于 2020-01-16 08:40:09
问题 I have a singleton that manages an array. This singleton can be accessed from multiple threads, so it has its own internal DispatchQueue to manage read/write access across threads. For simplicity we'll say it's a serial queue. There comes a time where the singleton will be reading from the array and updating the UI. How do I handle this? Which thread my internal dispatch queue is not known, right? It's just an implementation detail I'm to not worry about? In most cases this seems fine, but in