Z order

Bringing Objects To Front And Sending To Back Remember that UI objects such as buttons etc are all actually subviews [self.view bringSubviewToFront:MyButton]; [self.view sendSubviewToBack:MyButton]; Layers MyView.layer.zPosition = 1; //1 = front

Read More

UIView

Referencing A View In A .xib In #ViewController.h @interface SomeViewController : UIViewController { UIView *MyView; { @property (nonatomic, retain) IBOutlet UIView *MyView; In #ViewController.m @synthesize MyView; //<<<<DON’T FORGET THIS! – (void)viewDidUnload { self.MyView = nil; } Creating Programatically UIView *MyView = [[[UIView alloc] init] autorelease]; Moving A UIView CGRect frame = self.MyView.frame; frame.origin.x = 0; […]

Read More

Programatically Controlling Views

  Don't want to use UINavigationController or UITabBarController?  Then you have a problem as Apple doesn't provide the means to control an apps views programatically very easily, for instance using code like this: [viewController.view addSubview:AnotherViewController.view]; This aritcal explains the problem very well. Solutions Ignore the porblem!  This might be Ok if your app doesn't need to […]

Read More

Status Bar

Dealing With Status Bar Post iOS7 Good guide here Setting Status bar text white Set the UIViewControllerBasedStatusBarAppearance to YES in the .plist file. In the viewDidLoad do a [self setNeedsStatusBarAppearanceUpdate]; Add the following method: -(UIStatusBarStyle)preferredStatusBarStyle{      return UIStatusBarStyleLightContent;  } Status Bar Size 20 pixels Interface Builder Status Bar Setting The "Simulated Metrics" don't actually alter […]

Read More

Modal View Controller

To Show A View Controller Modally #ViewController_iPhone *vc1 = [[#ViewController_iPhone alloc] init]; [self presentModalViewController:vc1 animated:YES]; //[ptabBarController presentModalViewController:vc1 animated:YES]; //An alternative [vc1 release]; To Close It //Close this view [self dismissViewControllerAnimated:YES completion:nil]; Notes Use popViewControllerAnimated when you've used pushViewController:animated: Use dismissModalViewControllerAnimated when you've used presentModalViewController:animated:

Read More

Display View Over The Top Of Other View (Modal View)

A great way of placing a new view over the top of a TabBarController etc which uses the whole screen (except for the status bar is there is one) so it looks as though the tab bar etc has gone. Typical Use //Display modal view #ViewController_iPhone *vc1 = [[#ViewController_iPhone alloc] init]; [self presentModalViewController:vc1 animated:YES]; [vc1 […]

Read More

Renaming A ViewController

  Renaming A View Controller See here Renaming A Set Of View Files Rename the .h, .m and .xib files Update the name in the following places: In #ViewController.h update @interface In #ViewController.m update #import @implementation In #ViewController.xib update Select the Files Owner icon on the left, then the Identity Inspector tab and rename the […]

Read More

Change View Size

You may want to make a reduced size view for say an input box of some sort or a view that will be used at the same size for both iPhone and iPad devices. Setting the View Size Select the view.  In the attributes tab ensure that ‘Staus Bar’, ‘Top Bar’ and ‘Bottom Bar’ are […]

Read More

Passing Data To Another View

An Example Using A Class In #ViewController.h that you want to pass data to #import @class MyClassName; @interface #ViewController : UIViewController { MyClassName *myClass1; } @property (nonatomic, assign) MyClassName *myClass1; In #ViewController.m that you want to pass data to //Add import: #import “MyClassName.h” //Add synthesize: @implementation #ViewController @synthesize myClass1; //Deal with data: //********** VIEW WILL […]

Read More

ADDING OBJECTS TO VIEWS

Adding Objects To A View Declare The Inputs And Output in #ViewController.h Declare the objects you will output to (control from code) and methods for the objects providing input. Examples: IBOutlet UILabel *SomeLabel1; IBOutlet UILabel *SomeLabel2; IBOutlet UITextField *SomeTextField1; //### Remember to release any view objects you add in viewDidUnload and dealloc ### } – […]

Read More