I have a table view, which I want to create a custom UI navigation bar
UIView * view = [[UIView alloc] initWithFrame: CGRectMake (0.0, 0.0, self.view.bounds.size.width, self.view.bounds.size.height)]; // here for v, width = navbar width and height = navbar height // [view setbackgroundcolor: [UIColor colorWithPatternImage: [UIImage imageNamed: @ "newsBanner.png"]]]; [Self. Navigation Controller Add navigation bar view: view]; The problem is that the center of the image is not centered, its size is 640 x 72 ... is there a way to make it fit?
Your NAV bar should only be 44 pixels tall. Above it, it is a maximum of 320 points wide (640 pixels on retina devices, 320 on non-HD devices). So the size of your image is very large Create an image that has 320x44 dimensions, and then do this:
UINavigationBar * theBar = self.navigationController.navigationBar; If ([The Barber Reactive: @Selector (Setbackgage Image: For Bomatetrics)) {UIImage * image = [UIImage imageNamed: @ "Your Image Here"]; [The Bert Setbackground Image: Image for Bermatrix: UIBarMetricsDefault]; } Of course this will only work on iOS 5. You will need to find other ways to deal with setting up a background on the OS below 5.0. But there are many stack overflow questions addressing this issue :)
Comments
Post a Comment