This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Example | |
| //Pop views and return to mapresultsviewcontroller | |
| for(UIViewController *vc in [self.navigationController viewControllers]) { | |
| //MapAreaRsultsViewController is 2 controllers back in the hierarchy | |
| if([vc isMemberOfClass:[MapAreaResultsViewController class]]) { | |
| //Remove record from memory | |
| NSMutableArray *records; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Class will be declared later | |
| @class CustomClass; | |
| //Define the protocol for the delegate | |
| @protocol CustomClassDelegate | |
| @required | |
| //Required methods go here | |
| //If there are optional functions, they go here |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Set the (bool) flag | |
| [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"logged_in"]; | |
| [[NSUserDefaults standardUserDefaults]synchronize]; | |
| //Read it | |
| if(![[NSUserDefaults standardUserDefaults] boolForKey:@"logged_in"]) | |
| { | |
| [self displayLogin]; | |
| } else { | |
| [self displayMainScreen]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -(void) applicationDidEnterBackground:(UIApplication *) application | |
| { | |
| // You will also want to check if the user would like background location | |
| // tracking and check that you are on a device that supports this feature. | |
| // Also you will want to see if location services are enabled at all. | |
| // All this code is stripped back to the bare bones to show the structure | |
| // of what is needed. | |
| [locationManager startMonitoringSignificantLocationChanges]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (IBAction)addNotification:(id)sender { | |
| //Create the localNotification object | |
| UILocalNotification *localNotification = [[UILocalNotification alloc] init]; | |
| //Set the date when the alert will be launched using the date adding the time the user selected on the timer | |
| localNotification.fireDate:[NSDate dateWithTimeIntervalSinceNow:[datePicker countDownDuration]]; | |
| localNotification.timeZone = [NSTimeZone defaultTimeZone]; | |
| //The button's text that launches the application and is shown in the alert |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)customizeAppearance { | |
| // customize the navigation bar | |
| [[UINavigationBar appearance] setTitleTextAttributes:@{UITextAttributeFont : kNavigationBarTitleFont}]; | |
| [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"navbar.png"] forBarMetrics:UIBarMetricsDefault]; | |
| // UIBarButtonItem | |
| UIImage *button = [[UIImage imageNamed:@"button.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)]; | |
| [[UIBarButtonItem appearance] setBackgroundImage:button forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; | |
| [[UIBarButtonItem appearance] setTitleTextAttributes:@{UITextAttributeFont:[UIFont fontWithName:@"Verdana" size:0.0]} forState:UIControlStateNormal]; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @interface RightDetailedCell : UITableViewCell | |
| @property (nonatomic, assign) BOOL arrow; | |
| @property (nonatomic, assign) BOOL animated; | |
| @end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Official Info: | |
| http://developer.android.com/guide/components/fragments.html | |
| Same lifecycle methods with the Activity lifecycle methods apply | |
| extends DialogFragment | |
| Displays a floating dialog. Using this class to create a dialog is a good alternative to using the dialog helper methods in the Activity class, because you can incorporate a fragment dialog into the back stack of fragments managed by the activity, allowing the user to return to a dismissed fragment. | |
| extends ListFragment | |
| Displays a list of items that are managed by an adapter (such as a SimpleCursorAdapter), similar to ListActivity. It provides several methods for managing a list view, such as the onListItemClick() callback to handle click events. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Set the user interface layout for this Activity (activity_main.xml) | |
| //Usually in the onCreate method | |
| setContentView(R.layout.activity_main); | |
| //R.java file have all the resources IDs provided to resources(drawables, layouts, styles etc) | |
| //Example | |
| R.id.edit_message //id of a layout view in the xml | |