Best practice for applicationDidEnterBackground [closed] - iphone

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I am in the middle of writing an application that needs to reset certain parts of its state to a default state when the application calls applicationDidEnterBackground. What I would like to know is if it is a better practice to get a pointer to the view that needs to be reset and then reset the properties that need to be reset right there in the app delegate, or should I post an NSNotification that the app is entering the background and have the view controller do it's cleanup within itself. Or maybe there's another method I'm not thinking of.
I appreciate any input.

These notifications get posted already. Just subscribe to the event in your controller class(es) and do whatever you need to there.
From the docs:
The application also posts a
UIApplicationDidEnterBackgroundNotification
notification around the same time it
calls this method to give interested
objects a chance to respond to the
transition.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIApplication_Class/Reference/Reference.html#//apple_ref/c/data/UIApplicationDidEnterBackgroundNotification

Related

Best app cycle method to update UI in swift? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 days ago.
Improve this question
So I just want to increase my efficiency in programming and did not found any articles. I already know about the rule of main thread, but in which app cycle method I should put my UI configuration (viewDidLoad, viewDidLayoutSubviews, etc.)?
Thanks!
Currently I'm doing most of the changes in viewDidLayoutSubviews but sometimes I have to use willAppear method, which made me ask this question

Firestore Listeners Best Practices While Updating My UI [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
Do I need to put my Firestore listeners in my View Controller or can I put them in a model class? Based on my research, best practices is apparently to keep the database code within separate models.
However, I need to update my UI based on database changes.
That means I should at least attach the listeners within my View Controllers and not in the model, correct?
Or am I violating best practices here?
Blessings.
Tai
Yes, you need to put your listener on your viewController or you can create another class like singleton contains listener methods and with it's methods update the Ui.This also reduce the rewriting of the same code.

Teleprompter app in Xcode using Swift [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have finished an online course in iOS development on Udemy and I'm ready to start developing my first (real) app.
My goal is to make a teleprompter app similar to: https://itunes.apple.com/dk/app/video-teleprompter-lite/id1031079244?mt=8
To start with, I would like to create just the moving text. I have looked at various concepts such as Core Animation, Text View, Segue from one view controller to another etc. But none of them seem to be able to display the moving text in the proper "teleprompter way".
I would really appreciate suggestions as to how to start/which relevant concepts to look at in this context.
Try reading up on UIDynamics, UIPushBehavior.
https://developer.apple.com/reference/uikit/uidynamicanimator

Is there a way to create a series of UIAlertViews that are daisy chained into a decision tree? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Is there a way or a model by which I could create a "Choose your own adventure" type app using UIAlertViews?
While this is not a direct answer to the question, what you're going for here is going to provide a less than ideal user experience. Alerts are jarring and not really meant to be a constant UI element but more of an occasional interruption.
That said, if you do want to do something like this, using a block handler pattern rather than a delegate pattern will make the logic of your app much simpler and easier to follow.
For Xcode5/iOS7, I would recommend taking a look at BlocksKit which includes a category on UIAlertView to use completion blocks instead of a delegate.
New in iOS8 is the UIAlertController class which handles this very similarly without a need for an external component. It does require iOS 8 to use though.

iPhone Call handling within application [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to get the number from the incoming call, so that I can set the preference for an individual number. For instance, I want my cell to only ring if my Mom is calling otherwise leave it in vibrate mode.
Is there a method to get the number while call state is changed?
It is not possible to implement this functionality at the moment. Apple do not provide access to the phone call. If there is an incoming call, your app goes to background. If you want to make a call from the app - you can do it with a URL and your app again goes to background.