Here's the deal:
I have a navigation-based project with a menu screen as the root view. When I tap a button on the menu screen, the navigation controller pops a KalViewController onto the stack (kal calendar).
The calendar appears, and for about a 6 second period the calendar is downloading JSON data from the internet to populate the calendar with events. However, if the user taps Back (to go back to the main menu) during this time, the app crashes or the calendar continues to load the data even when I am on the main screen. (evidenced by the network activity indicator continuing to spin)
1-- I was wondering if there is any way, when I tap the Back button, to cancel that download process so that my objects will release properly? (maybe using threads??)
OR
2-- Somehow prevent the user from tapping the back button while the data is still downloading. (Similar to how a UIAlertView prevents a user from clicking anything on the screen except for 'OK' to dismiss the alert message)
PLEASE help! Thank you very much in advance!
Related
When running my app on my device, I have a button that brings up a new view controller. In the function viewDidAppear of the new view controller, I begin processing a bunch of data previously entered. This data takes about 15 seconds to be processed. At the top of this new view controller is a navigation bar with a Bar Button Item where the user can touch it to return to the home page. However, during the first 15 seconds while the app is processing the data, the navigation bar and the Bar Button Item is completely unresponsive. Is there any way to be able to interact with the user while processing data at the same time?
https://developer.apple.com/LIBRARY/ios/documentation/Performance/Reference/GCD_libdispatch_Ref/index.html
Use dispatch_async to launch the 'processing' and dispatch_main if/when it needs to update the UI.
Not Swift, but Ray Wenderlich has a couple of tutorials:
http://www.raywenderlich.com/4295/multithreading-and-grand-central-dispatch-on-ios-for-beginners-tutorial
http://www.raywenderlich.com/60749/grand-central-dispatch-in-depth-part-1
I used ActionSheetDatePicker of Tim Cinel (in github) and got a problem when use date picker, I can't interact with date picker control when test on device (only device!), I can still press "Done" button to dismiss the action sheet. Bellow is screen shoot of ActionSheetDatePicker:
Note: my app used navigation controller, maybe this is reason, but why :(
i am creating an alarm app by making of use of local notification.when i select a particular time from my date picker and click on the save button my notification gets set at that particular time.This has been done and i get the notification at proper time that i have set.but the problem is when my app is not running i get notification with 2 buttons i.e one for close and other for view details .when i click on close button my notification close and when the view details button is clicked it takes me to my app.But actually i dont't need this. i want in place of close button snooze button should be present and in place of view button stop button should appear. i.e when my alarm notification is fired i want that in place of close and view button stop and snooze button should appear.When i click on stop button alarm should get stopped and when the snooze button is clicked the alarm is delayed for 5 mins.Please help me in solving my problem.Thanks
The alert displayed by a push/local notification has either one (OK) button, or two buttons - the left button is always "Close" and the right button is either "View" or a string (for action-loc-key) you supply in the dictionary for the alert key of your payload.
The functionality you require isn't available using the notification alerts directly. Maybe your app could "snooze" by default (i.e. when the close button is pressed - so unless the app is started the alarm plays again after 5 minutes). If the user presses the View button (maybe re-titled "Cancel Alarm") the app starts and the alarm is cancelled.
See The Notification Payload in
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html
I have a few different views in my App, all of which are viewed by tapping different buttons. All the buttons work on the simulator, but when I run the app on the device only one button does not work. I went over and over my code and re coded that one button and re-connected it in IB to make sure that i did not mess something dumb up, but it still freezes my app.
When the bad button is tapped the App will freeze but not shut off and the only way to unfreeze it is to press the home button.
Any thoughts on why this might be happing only to this one button?
I got it! It was something really dumb! In the view that is loaded when the button is tapped there is a picker. What was happening is that I have a BOOL value that needs to be set to true when the button is tapped and I forgot to set it. Without that BOOL value being set the picker was not being loaded the right way.
I have a navigation based template application, I parse data into table view.
I want to put a login screen before parse the data. I did the login screen and and succeed the login check.
My problem is that when the user presses the button I change the view to the tableview.
what a way should I draw? I want to learn how can i close the tableview screen when the app launched and after pressed the button I want to show the tableview.
If you are using a navigation based template, you could simply push another view on the stack, or you could have the second table view as the first screen, and push the login over the top. pressing on a button to login will pop the login screen off the stack to reveal the main tableview screen.
I have put the login details in the user preferences screen.