Search Results

Search found 118 results on 5 pages for 'uinavigationbar'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • How to add a custom button to a UINavigationBar (a la Foursquare)

    - by jfisk
    Im going through the different options of creating a custom UINavigationBar and since my app is iOS 5+, i am using this code: // Set the background image all UINavigationBars [[UINavigationBar appearance] setBackgroundImage:NavigationPortraitBackground forBarMetrics:UIBarMetricsDefault]; Now i want a custom image button on the very right side and am a bit lost. Should I go another way, subclass UINavigationBar and add a button to it or would there be an easier way?

    Read the article

  • Changing UINavigationBar font in Swift

    - by dcgoss
    I have a UINavigationBar with a title in the middle. I have added a custom font ("Comic_Andy.ttf") to my app (I have checked info.plist to make sure it's listed, and I have checked the Copy Bundle Resources to make sure it has been added), and I would like the title of the UINavigationBar to be displayed in that font. From what I can gather it seems as though I'm supposed to use this in my ViewController: myNavigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "Comic_Andy", size: 22)] I placed that method in the viewDidLoad function of the ViewController. I have also tried this in the didFinishLaunchingWithOptions function of the AppDelegate: UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Comic_Andy", size: 22)] I am programming in Swift, in XCode 6 Beta 6. Many resources regarding this task have mentioned using a method called setTitleTextAttributes, which is nowhere to be seen. I can't figure it out for the life of me - I've probably spent close to 3 hours on it by now - I have checked every StackOverflow answer, every website, so please do not mark this as a duplicate. Many thanks in advance!

    Read the article

  • Remove Custom UINavigationBar

    - by Lithium
    Hi, I've customized my UINavigationBar with an image like that : @implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"NavigationBar.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; } @end When I launch a video my custom NavigationBar (with the picture) is on the top or I would like to have the default navigationBar style when I'm playing a video. I tried to hide the navigationBar with [self.navigationController setNavigationBarHidden:YES animated:animated]; but it just remove the navigationBar in my controller but I still have the NavigationBar.png when I'm playing a video. I tried to set the barstyle but it doesn't work either ... self.navigationController.navigationBar.barStyle = UIBarStyleDefault; Could you help me ?

    Read the article

  • iPhone - Tweak the UINavigationController to show a UINavigationBar made into IB

    - by Oliver
    Hello, I've build a UINavigationBar into Interface Builder, and I have a NavigationController into my app. I'd like to make the one use the other to work. Just to manage the bar into IB and let the controller use it as its view (and adding by itself the Back button if needed), or in another way to do the same thing, let the NavBar use the navcontroller to adjust its display. Do you see a way to do this ? If not, I really don't see the use of the NavigationBar proposed into IB.

    Read the article

  • How to change UINavigationBar background image - iphone sdk ?

    - by tester
    first of all, i read all "changing uinavigationbar color & backgound image", but i couldnt get over my problem. i have a tabbar app with 4 tabs. each tab has navigationcontroller. (i arranged all the objects in mainwindow.xib file in IB) in thew first tab, i wanna display 1.jpg on navigationbars background image in first view. when the use taps the tableviews row, how can i display "2.jpg" on navigationbar for second view? i also wanna display different images for each tabs. how can i solve it? thanx for all.

    Read the article

  • Using undecorated UiNavigationBar

    - by Nicsoft
    Hello, I would like to use UINavigationBar without decoration. I.e. I would like to create my own custom buttons and link those to the same actions (e.g. back) as the navigation items were linked to and have no bar presented at the top. I was told that one should use navigation bar even though graphically you should design the interaction yourself. How do I go about doing this? I am quite new to navigation bar to start with... If there is some tutorial you can direct me to it would be great (that is for using nav-bar without decoration). Thanks in advance! Regards, Niklas

    Read the article

  • Custom background for UINavigationBar in landcape mode

    - by lostInTransit
    Hi I am adding a custom background for my UINavigationBar. It works fine as long as the phone is in portrait mode. As soon as I switch to landscape mode, half the bar appears blue (the default navbar color) and half of it has my image How can I stretch the image for landscape mode and make it small again for portrait mode? Thanks Solution Incase anyone is looking for an answer to how to add an image to navigation bar - here goes UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 480.0, 44.0)]; [imgView setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"navbar_landscape" ofType:@"png"]]]; [navigationController.navigationBar addSubview:imgView]; [imgView release];

    Read the article

  • UISearchBar in UINavigationBar with ScopeBar

    - by ncipollina
    I am trying to put a UISearchBar inside of the UINavigationBar, which I am able to do without much problem. The problem is that I have logic when editing to show the Scope Bar. This all works fine, with one exception. The navigation bar tries to center the UISearchBar inside of the title view. This causes the search bar to move up above the navigation bar. I tried adding some logic to set the frame of the search bar so that it just draws overtop of my main view, which is fine. I can only set the height, which causes the search bar to draw over the view just fine, but it isn't wide enough to cover the whole screen. If I set the width on the frame, it goes back to the same behavior of trying to center the UISearchBar on the navigation bar. Anyone know how I can accomplish this? Thanks, Nick

    Read the article

  • Subclassing UINavigationBar ... how do I use it in UINavigationController?

    - by funkadelic
    Hi, I wanted to subclass UINavigationBar (to set a custom background image & text color) and use that for all the navigation bars in my app. Looking at the API docs for UINavigationController, it looks like navigationBar is read-only: @property(nonatomic, readonly) UINavigationBar *navigationBar Is there a way to actually use a custom UINavigationBar in my UIViewControllers? I know that other apps have done custom navigation bars, like flickr: Here is my UINavigationBar subclass: #import <UIKit/UIKit.h> @interface MyNavigationBar : UINavigationBar <UINavigationBarDelegate> { } @end the implementation #import "MyNavigationBar.h" @implementation MyNavigationBar - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code } return self; } - (void)drawRect:(CGRect)rect { // override the standard background with our own custom one UIImage *image = [[UIImage imageNamed:@"navigation_bar_bgd.png"] retain]; [image drawInRect:rect]; [image release]; } #pragma mark - #pragma mark UINavigationDelegate Methods - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated{ // use the title of the passed in view controller NSString *title = [viewController title]; // create our own UILabel with custom color, text, etc UILabel *titleView = [[UILabel alloc] init]; [titleView setFont:[UIFont boldSystemFontOfSize:18]]; [titleView setTextColor:[UIColor blackColor]]; titleView.text = title; titleView.backgroundColor = [UIColor clearColor]; [titleView sizeToFit]; viewController.navigationItem.titleView = titleView; [titleView release]; viewController.navigationController.navigationBar.tintColor = [UIColor colorWithRed:0.1 green:0.2 blue:0.3 alpha:0.8]; } - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated{ } - (void)dealloc { [super dealloc]; } @end I know that I can use a category to change the background image, but i still want to be able to set the text color of the navigation bar title @implementation UINavigationBar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @"navigation_bar_bgd.png"]; [image drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; } @end any suggestions or other solutions? I basically want to create a light background and dark text like Flickr's app navigation bars

    Read the article

  • How to hide UIStatusBar and show UINavigationBar at the top when UIView changes to LandscapeOrientat

    - by KayKay
    I am using two views (portraitView and landscapeView) loaded from xib in a viewcontroller for different InterfaceOrientation each for Portrait and Landscape mode. The view in portrait mode has statusbar and navigationbar and other one has just the navigationbar. The problem is that even i made statusbar hidden programatically the view in Landscape mode has blank space left at the position of statusbar and below is navigationbar which is for sure looking embarrassing. Is it possible to put the navigationbar at the top - replacing the statusbar position. I tried many options like. if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) { [[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO]; self.navigationController.navigationBarHidden = NO; [[self view] setFrame:CGRectMake(0, 0, 480, 320)]; self.navigationController.wantsFullScreenLayout = YES; self.view = self.landscapeView; } But despite all this efforts it only lefts the same 20x480 pixels blank space and below it navigationbar. But here there is no end to trouble when I switch back to portraitView, the navigation bar hides behind the statusbar mere showing remaining 320x(44-20)px on top. Please help and thanks in advance.

    Read the article

  • UINavigationBar height

    - by kpower
    In my app I work with an UINavigationController. I've added it to the window (MainWindow.xib, with IB) and simulated on my main view (in IB: Simulated User Elements / Top Bar / Navigation Bar). Navigation bar is displayed, but its height isn't standard. At least in IB it is bigger than in launched app. What's wrong? And how can I restore height to the initial state (as in IB)? P.S.: I know that I can set it directly from code. But this way looks like a "crutch".

    Read the article

  • UINavigationBar multi-line title

    - by benasher44
    Is there a straightforward way of overriding the titleView of the current navigation bar item in a navigation bar within a navigation controller? I've tried creating a new UIView and replacing the titleView property of topView with my own UIVIew with no success. Basically, I want a multi-line title for the navigation bar title. Any suggestions?

    Read the article

  • UINavigationBar is getting buttons from another view

    - by Rafael Oliveira
    I have three Views, Splash, Login and List. From Splash I just wait and then Push Login View, with the Navigation Bar hidden. In Login I Show the NavigationBar, hide the BackButton1 and add a new RightButton1, then I check if Settings.bundle "login" and "pass" are set. If so, I push List View. Otherwise I stay in the Login view waiting for the user to fill the form and press a button. In List View I add a new RightButton2 and a new BackButton2. The problem is that if Settings.bundle data is not null, and in Login View I quickly push List View the RightButton1 appears in List View, or no buttons appear at all, or only BackButton2 doesn't appear... The most strange thing of all is that everything was OK and all of sudden it started to get messy. Login View: // Making the Navigation Bar Visible [self.navigationController setNavigationBarHidden:NO animated:NO]; // Hiding the Back Button in THIS view (Login) [self.navigationItem setHidesBackButton:YES]; // Inserting the Logout Button for the Next View (List) UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = backButton; [backButton release]; UIBarButtonItem* newAccountButton = [[UIBarButtonItem alloc] initWithTitle:@"New Account" style:UIBarButtonItemStylePlain target:self action:@selector(newAccountButtonPressed)]; self.navigationItem.rightBarButtonItem = newAccountButton; [newAccountButton release]; List View // Making the Navigation Bar Visible [self.navigationController setNavigationBarHidden:NO animated:NO]; UIBarButtonItem* aboutButton = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStylePlain target:self action:@selector(aboutButtonPressed)]; self.navigationItem.rightBarButtonItem = aboutButton; [aboutButton release]; Any ideas ?

    Read the article

  • How to determine UINavigationBar custom view text/shadow color for different styles in UISplitViewCo

    - by Cal
    I have a splitview with a pop over master view using UINavigationController. The problem is I have some custom text views in the header of the nav controller and when it switches to the pop-over view the style of the nav bar changes. This makes the colors of the text clash since they are no longer using the correct settings for the new navbar style. How do you determine the proper default text colors for a given navigation bar (style)? The issue is because I'm using a split view in the iPad but you should be able to determine the proper colors for an iPhone nav bar too.

    Read the article

  • How to restrict rightBarButtonItem size in UINavigationBar ?

    - by lefakir
    I create a rightBarButtonItem with this method : - (UIBarButtonItem *)customBarButtonWithSelector:(SEL)callback { UIButton *customButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; customButton.bounds = CGRectMake(0, 0, 30.0f, 30.0f); return [[[UIBarButtonItem alloc] initWithCustomView:customButton] autorelease]; } At execution time the selector is fired when the bar is touched outside the button (near the middle). Is there a way to restrict the event responder in the defined bounds or in a acceptable range ?

    Read the article

  • UINavigationBar BarButtonItem with Plain Style

    - by choise
    Hi, i got the following code: - (id)init { if (self = [super init]) { self.title = @"please wait"; UIBarButtonItem *favorite = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"star.png"] style:UIBarButtonItemStylePlain target:self action:@selector(buttonFavoriteClicked:)]; self.navigationItem.rightBarButtonItem = favorite; } return self; } but my button looks still like a Button with UIBarButtonItemStyleBordered is there a way to set a button with plain style at this position?

    Read the article

  • Change title of UINavigationBar

    - by Lemmy
    I've created a view-based application. I've placed a Navigation Bar on the view and two buttons. I'd like to change the title of the nav bar after pressing the buttons. In IB I've connected the buttons with the corresponding actions. Debugging shows that the actions are getting called but the title of the nav bar is not changed. Kindly help! // // NavBarViewController.h #import <UIKit/UIKit.h> @interface NavBarViewController : UIViewController { } -(IBAction) clickedOne: (id)sender; -(IBAction) clickedTwo: (id)sender; @end // // NavBarViewController.m #import "NavBarViewController.h" @implementation NavBarViewController -(IBAction) clickedOne: (id)sender { self.navigationItem.title = @"1"; } -(IBAction) clickedTwo: (id)sender { self.navigationItem.title = @"2"; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (void)dealloc { [super dealloc]; } @end

    Read the article

  • UISearchBar delegate not called when used as UINavigationBar titleVIew?

    - by phooze
    I have a UITableViewController that I have specified as a UISearchBarDelegate. Up until now, I had programmatically added the UISearchBar to the headerView of the table, and there were no problems. I began to run out of screen real estate, so I decided to kill my normal UINavigationController title (which was text), and added the following code, moving my SearchBar from the table to the UINavigationBar: // (Called in viewDidLoad) // Programmatically make UISearchBar UISearchBar *tmpSearchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0,0,320,45)]; tmpSearchBar.delegate = self; tmpSearchBar.showsCancelButton = YES; tmpSearchBar.autocorrectionType = UITextAutocorrectionTypeNo; tmpSearchBar.autocapitalizationType = UITextAutocapitalizationTypeNone; [self set_searchBar:tmpSearchBar]; [tmpSearchBar release]; self.navigationItem.titleView = [self _searchBar]; This code works as expected - my UINavigationBar is now a UISearchBar. However, my delegate method: /** Only show the cancel button when the keyboard is displayed */ - (void) searchBarDidBeginEditing:(UISearchBar*) lclSearchBar { lclSearchBar.showsCancelButton = YES; } ...is no longer being called. I've breakpointed, and I've confirmed that the UISearchBar's delegate is indeed self, the view controller. Oddly, this delegate method is still called just fine: /** Run the search and resign the keyboard */ - (void) searchBarSearchButtonClicked:(UISearchBar *)lclSearchBar { _deepSearchRan = NO; [self runSearchForString:[[self _searchBar] text] isSlowSearch:NO]; [lclSearchBar resignFirstResponder]; } Any ideas why UINavigationBar is swallowing my delegate calls?? What am I missing?

    Read the article

  • How no make a button show UINavigationBar only in 3 of 5 tabs in UITabBar?

    - by Mike Rychev
    I have an app, where there's a UITabBar with 5 tabs. When user shakes the device, I want the UINavigationBar to push an UIImageView. When I show the UIImageView, I need to hide both tab and nav bars. After that, when user taps the UIImageView, the NavBar appears again and user can go to the UIImageView's parent view. I make the Nav Bar appear like this: [[self navigationController] setNavigationBarHidden:NO animated:YES]; But in two tabs I have to make the Nav Bar appear, so user can switch to UIImageView's parentView and then, when the parent view appears, hide the nav bar. How can I do it?

    Read the article

  • Why can't I set a custom color-tint for the UINavigationBar?

    - by mobibob
    I want to change the color on the navigation bar and the documentation states not to attempt to change the 'alpha' value. So, how can I set a color that is not the SDK defined values (e.g., [UIColor redColor], brownColor, etc.) if all the constructors provide an alpha value? I tried getting the current alpha value but that did not help. When I use a custom color, it causes the navigation bar to look like an x-ray (a scraggy, black-on-white). [self.navigationController.navigationBar setTintColor: [UIColor brownColor]];

    Read the article

  • Hide button on first of two UIViews, but have it visible on second...

    - by Scott
    So I have a UIViewController (main application controller is a TabBarController). On this there is a UINavigationBar, and a UIBarButtonItem. I'm PRETTY sure I hooked up everything correctly in the Interface Builder and that the outlet in the code is connected to the button in the .xib. It should be because the method works correctly. Now I have another button on this view that brings up a second view, a UIWebView. I want this UIBarButtonItem, labeled "Back", to make the UIWebView dissapear, and bring back the first UIView, which it DOES DO correctly. However, when you are on the first UIView, there is no need to see the UIBarButtonItem, so how can I hide it but then bring it up for the UIWebView. By the way, both views use the same UINavigationBar, the UIWebView is brought up inside the tab bar and the nav bar. Here is my code: #import "WebViewController.h" @implementation WebViewController @synthesize webButton; @synthesize item; @synthesize infoView; UIWebView *webView; + (UIColor*)myColor1 { return [UIColor colorWithRed:0.0f/255.0f green:76.0f/255.0f blue:29.0f/255.0f alpha:1.0f]; } // Creates Nav Bar with default Green at top of screen with given String as title + (UINavigationBar*)myNavBar1: (NSString*)input { UIView *test = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; UINavigationBar *navBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, test.bounds.size.width, 45)]; navBar.tintColor = [WebViewController myColor1]; UINavigationItem *navItem; navItem = [UINavigationItem alloc]; navItem.title = input; [navBar pushNavigationItem:navItem animated:false]; return navBar; } - (IBAction) pushWebButton { self.navigationItem.rightBarButtonItem = item; CGRect webFrame = CGRectMake(0.0, 45.0, 320.0, 365.0); webView = [[UIWebView alloc] initWithFrame:webFrame]; [webView setBackgroundColor:[UIColor whiteColor]]; NSString *urlAddress = @"http://www.independencenavigator.com"; NSURL *url = [NSURL URLWithString:urlAddress]; NSURLRequest *requestObj = [NSURLRequest requestWithURL:url]; webView.scalesPageToFit = YES; [webView loadRequest:requestObj]; [self.view addSubview:webView]; [webView release]; } - (void) pushBackButton { [webView removeFromSuperview]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (void)viewDidLoad { self.navigationItem.rightBarButtonItem = nil; [super viewDidLoad]; } @end Anyone know?

    Read the article

1 2 3 4 5  | Next Page >