nsnotifications

Managing NSNotification along with UITabBarController interactions

二次信任 提交于 2019-12-11 04:37:10
问题 I have 1 main UIViewController that contains a UITabBarController. The tab bar controller has 4 UIViewControllers (each managed by UINavigationControllers). Succinctly, it looks like this: MainViewController | |--- FirstUIViewController | |--- SecondUIViewController | |--- ThirdUIViewController | |--- FourthUIViewController The FirstUIViewController is loaded by default. In the SecondUIViewController, there is an event that can occur. This event has specific data that is passed along with it.

PushNotifications iOS 7 not working when user taps on icon

你说的曾经没有我的故事 提交于 2019-12-11 02:27:11
问题 I have the methods below to handle push notifications. They work perfect when the app is running and I do receive notifications when the app is in the background. When a user taps the icon however it opens the app but my UICollection view is not reloaded the way it is when a user receives the notification when the app is running. -(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { UIApplicationState state = [application applicationState]; if

Removing observers in post-ARC Cocoa

邮差的信 提交于 2019-12-10 17:44:04
问题 So far I have been removing observers (notifications or KVO) in the dealloc. Since dealloc is gone in ARC, what's the recommended way to do this? 回答1: -dealloc is not gone under ARC. The ivar-releasing and super-calling aspects are handled automatically, allowing you to omit it if that's all you were going to do, but you should still implement it for other things if it makes sense to do so. 来源: https://stackoverflow.com/questions/7827953/removing-observers-in-post-arc-cocoa

Notifications are not getting in iOS 9.2

帅比萌擦擦* 提交于 2019-12-10 00:45:54
问题 Notifications are not getting after upgrade to iOS9.2 but up to iOS9.1 there is no such type of issue. But I didn't understand where was the problem. Is it iOS9.2 problem ? Can anyone help me out from this. Thanks in advance. 回答1: iPhone 4s seems to be having little discrepancies in ios 9.2 like notification icons are coming but no vibrations or sound alerts are there. Are you using a iPhone 4s? 来源: https://stackoverflow.com/questions/34528733/notifications-are-not-getting-in-ios-9-2

How to find out what UITextField caused a UIKeyboardWillShowNotification?

 ̄綄美尐妖づ 提交于 2019-12-09 14:20:13
问题 I am trying to use a customized keyboard in my application, but I am hitting problems when trying to restrict it to one particular UITextField. I based my code on this Xcode project (originally found on this blog). That code adds a custom UIButton (representing a 'decimal point') into the UIKeyboardTypeNumberPad keyboard view. It does it by subscribing to UIKeyboardWillShowNotification and modifying the keyboard when it appears. That Xcode project works great, but when I add an extra

Is there an NSNotification for phone call status

最后都变了- 提交于 2019-12-09 01:00:05
问题 Is there an NSNotification we can observe for when the device is on/off the phone? 回答1: The NotificationCenter doesn't send out any notifications abou this, but take a look at the CTCallCenter class introduced in iOS 4. It has a callEventHandler property that you can assign a block of code to, and gets called with call state info. There is a limitation in that the handler only gets called when your app is in the foreground (or being taken out of the foreground when a call comes in), but it

Is it possible to open running background app on in Objective c

假装没事ソ 提交于 2019-12-07 18:57:04
问题 open my app from background running on a specific timing.. want to do somthing like this - (void)applicationDidEnterBackground:(UIApplication *)application { timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO]; } - (void)timerFired:(NSTimer*)timer { NSLog( @"yes it is running..."); PickUpCallViewController *call=[[PickUpCallViewController alloc]initWithNibName:@"PickUpCallViewController" bundle:nil]; navi=[

IOS - Delegate vs Notification

感情迁移 提交于 2019-12-07 04:39:41
问题 Would like to have your opinion regarding the following architecture: In My app I have a static class (LoginManager) that handles an asynchronous login. Once the login phase is completed the app should response and transition to another state. I have 2 implementation suggestions using a Delegate: import Foundation protocol LoginManagerDelegate{ func onLogin(result:AnyObject) } class LoginManager { struct Wrapper { static var delegate:LoginManagerDelegate? } class func userDidLogin(result){

Is there a notification on iOS if a UIAlertView is shown?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 03:35:45
问题 Wondering if there is a notification available if a UIAlertView pops up? Background: my app asks the user for a PIN after a period of inactivity but I would like to prevent it if an alert is on screen. I don't want to go through my code and find all alerts and disable the PIN checker, instead a notification would be awesome. Any hope with NSNotification ? 回答1: Just found the answer. It is hidden in here: Can I get message when I show UIAlertView If you listen to the "

Is it possible to open running background app on in Objective c

核能气质少年 提交于 2019-12-06 08:35:36
open my app from background running on a specific timing.. want to do somthing like this - (void)applicationDidEnterBackground:(UIApplication *)application { timer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(timerFired:) userInfo:nil repeats:NO]; } - (void)timerFired:(NSTimer*)timer { NSLog( @"yes it is running..."); PickUpCallViewController *call=[[PickUpCallViewController alloc]initWithNibName:@"PickUpCallViewController" bundle:nil]; navi=[[UINavigationController alloc]initWithRootViewController:call]; [[navi navigationController] setNavigationBarHidden:YES