"YOU AND THE ART OF ONLINE DATING" is the only product on the market that will take you step-by-step through the process of online dating, provide you with the resources to help ensure success. Get it now!
Solution 1: Modify your nib The usually accepted solution to this is to add a UINavigationBar or UINavigationController to your nib and specify your custom navbar class there. This works perfectly fine if you already have or don't mind having a navbar in your nib along with your UIViewController UI. I really prefer to keep my UINavigationBar separate from my other UI though, so I almost never use this Solution 2: Use NSKeyedUnarchiver This is my favorite solution.It completely code-based (no IB/NIB required) and can be dropped in almost anywhere MyViewController *controller = MyViewController alloc init autorelease; NSKeyedUnarchiver *unarchiver = NSKeyedUnarchiver alloc initForReadingWithData:NSKeyedArchiver archivedDataWithRootObject:controller autorelease; unarchiver setClass:MyNavigationBar class forClassName:@"UINavigationBar"; controller = unarchiver decodeObjectForKey:@"root" Solution 3: Create a stand-alone nib with a UINavigationController This, IMO is a bit hacky, but it works and is easy to implement.
It relies on the fact that you can get a UINavigationController object directly from a nib UINib *nib = UINib nibWithNibName:@"MyNavControllerNib" bundle:nil; UINavigationController *navController = nib instantiateWithOwner:nil options:nil objectAtIndex:0 Solution 4: Inject the new class at runtime Update: As of the release version of iOS5, this approach no longer works However, I almost never have a UINavigationBar or UINavigationBarController in my nib. I don't like having it in there -- it's the job of the UINavigationController to determine when and how to insert a UINavigationBar and specifying a navController inside a nib is not a great design, IMO.In addition, refactoring my nibs to include it means lots of retesting of code So, there is a solution that is better, particularly if you are porting your apps to iOS5, but need backwards compatibility with earlier versions. With this approach, you don't have to refactor your existing nibs: import object_setClass(self.
NavigationController. NavigationBar, MyNavBar class) This will replace the navigationBar class the navigationController uses at runtime with your custom UINavigationBar subclass. Just add the code to viewDidLoad : (void)viewDidLoad { super viewDidLoad; object_setClass(self.
NavigationController. NavigationBar, MyNavBar class); // the rest of your viewDidLoad code }.
Solution 1: Modify your nib The usually accepted solution to this is to add a UINavigationBar or UINavigationController to your nib and specify your custom navbar class there. This works perfectly fine if you already have or don't mind having a navbar in your nib along with your UIViewController UI. I really prefer to keep my UINavigationBar separate from my other UI though, so I almost never use this.
Solution 2: Use NSKeyedUnarchiver This is my favorite solution. It completely code-based (no IB/NIB required) and can be dropped in almost anywhere. MyViewController *controller = MyViewController alloc init autorelease; NSKeyedUnarchiver *unarchiver = NSKeyedUnarchiver alloc initForReadingWithData:NSKeyedArchiver archivedDataWithRootObject:controller autorelease; unarchiver setClass:MyNavigationBar class forClassName:@"UINavigationBar"; controller = unarchiver decodeObjectForKey:@"root"; Solution 3: Create a stand-alone nib with a UINavigationController This, IMO is a bit hacky, but it works and is easy to implement.It relies on the fact that you can get a UINavigationController object directly from a nib.
UINib *nib = UINib nibWithNibName:@"MyNavControllerNib" bundle:nil; UINavigationController *navController = nib instantiateWithOwner:nil options:nil objectAtIndex:0; Solution 4: Inject the new class at runtime. Update: As of the release version of iOS5, this approach no longer works. However, I almost never have a UINavigationBar or UINavigationBarController in my nib.
I don't like having it in there -- it's the job of the UINavigationController to determine when and how to insert a UINavigationBar and specifying a navController inside a nib is not a great design, IMO. In addition, refactoring my nibs to include it means lots of retesting of code.So, there is a solution that is better, particularly if you are porting your apps to iOS5, but need backwards compatibility with earlier versions. With this approach, you don't have to refactor your existing nibs: #import object_setClass(self.
NavigationController. NavigationBar, MyNavBar class); This will replace the navigationBar class the navigationController uses at runtime with your custom UINavigationBar subclass. Just add the code to -viewDidLoad: - (void)viewDidLoad { super viewDidLoad; object_setClass(self.
NavigationController. NavigationBar, MyNavBar class); // the rest of your viewDidLoad code }.
This doesn't work with drawLayer:inContext: or drawRect: in the subclass. I verified that it is indeed getting loaded by overriding setTag, but the drawLayer:inContext is not being called on iOS 5 – coneybeare Oct 8 at 17:06 @coneybeare Yep. As of the GM release it no longer works.It did in the previous beta though.
– Answerbot Oct 8 at 17:36 Updating answer to include another alternative that will work with iOS5 GM. – Answerbot Oct 8 at 17:36 Solution 2 worked great for me, thanks! – dizy Oct 16 at 4:00 1 PS.
You can also swizzle UINavigationController's initWithRootViewController, and add solution 2 in there to make life easier. – dizy Oct 16 at 14:53.
The only supported way to do this in iOS 4 is to use the Interface Builder method. You don't have to use IB to do anything except set the UINavigationBar subclass (you can still do all of your view set up programmatically).
Although this does seem to be the only current way to do it -- this approach is very, very broken. For example, if you have a UITableViewController, there is nowhere to add a UINavigationBar from IB. – Answerbot Oct 6 at 16:15 You would not add a UINavigationBar to a UITableViewController.
You would add the UITableViewController to a UINavigationController, and access that navigation controllers UINavigationBar property. – Ross Kimes Oct 17 at 22:17 Yes, if you wanted to refactor your NIB to be based inside a UINavigationController, then you could certainly do that. But typically, that is not how most devs set up their NIBs.
There is nothing wrong with this approach, I'm just not a fan of any approach that requires me to refactor that much. – Answerbot Oct 19 at 17:09.
The usually accepted solution to this is to add a UINavigationBar or UINavigationController to your nib and specify your custom navbar class there. This works perfectly fine if you already have or don't mind having a navbar in your nib along with your UIViewController UI. I really prefer to keep my UINavigationBar separate from my other UI though, so I almost never use this.
This is my favorite solution. It is completely code-based (no IB/NIB required) and can be dropped in almost anywhere.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.