I've got an app that uses a UINavigationController. I need some unique behavior, and I turn to you in hopes of a best strategy, as well as letting you know what I've done so far.
The behavior I need:
I have 1 and 2 mostly down. 3 I'm struggling with, and it's making me question whether or not my approach with 1 and 2 is sound.
Here's what I've done to accomplish 1 and 2:
If anyone could help me with an appropriate strategy, it would be much appreciated. Additionally, is there some way to know whether or not we are on a high resolution device? In cases where I am naming specific pixels such as the above example, it seems like it would be necessary to know that in order to get the correct pixel size.
Thanks again.
The behavior I need:
- Draw a custom background bar image.
- Create a secondary image that sits on top of the bar, next to the app title.
- Have the secondary image slide in and out along with the text, when the user navigates towards or away from the root view.
I have 1 and 2 mostly down. 3 I'm struggling with, and it's making me question whether or not my approach with 1 and 2 is sound.
Here's what I've done to accomplish 1 and 2:
Code:
@implementation UINavigationBar (CustomImage)
- (void)drawRect:(CGRect)rect
{
UIImage *image = [UIImage imageNamed:@"MyBar.png"];
[image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height )];
DayoAppDelegate* ourDelegate = (DayoAppDelegate*)[[UIApplication sharedApplication] delegate];
if( ourDelegate != nil )
{
if( [ourDelegate isInRootView ] == YES )
{
UIImage *logoImage = [UIImage imageNamed:@"MyLogo.png"];
[logoImage drawInRect:CGRectMake( (0.28f * self.frame.size.width), (0.05f * self.frame.size.height), 41, 40 )];
}
else
{
// Do nothing.
}
}
}
@end
If anyone could help me with an appropriate strategy, it would be much appreciated. Additionally, is there some way to know whether or not we are on a high resolution device? In cases where I am naming specific pixels such as the above example, it seems like it would be necessary to know that in order to get the correct pixel size.
Thanks again.