uinavigationbar

iOS7: UICollectionView appearing under UINavigationBar

大憨熊 提交于 2019-12-02 19:22:28
I've been building on iOS 7 for a while now but I've yet to get this solved, I have a number of views with autolayout enabled that were created in Storyboard and are displayed with a standard UINavigationController . The majority are fine, but the ones based on UICollectionView always place themselves under the navigation bar, unless I set the translucency to NO . I've tried the edgesExtended trick but that doesn't seem to solve it, I don't necessarily mind having the translucency off but I'd like to solve it cleaner. Antonio MG I had this problem before, just set the edge insents of the

Create NavBar programmatically with Button and Title Swift

不羁岁月 提交于 2019-12-02 19:01:05
I try to create a NavBar, so far the NavBar is no problem but if i try to add buttons and the title i get sucked. My NavBar look like let NameHeight = screenHeight * 0.09 let NameWidth = screenWidth let navBar: UINavigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: NameWidth, height: NameHeight)) self.view.addSubview(navBar) so i try to set my NavBar title like navigationBar.topItem.title = "some title" or navigationBar.title = "some title" but both fail. Also if i try to set a button let btnName = UIButton() btnName.setImage(UIImage(named: "imagename"), forState: .Normal) btnName

Using Segmented Controller to Change Views [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 18:39:39
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . I am aware that this question has been asked previously, and I know how to actually change views or view controllers w/ a segmented control, but I have a more specific problem. I had my UI designed, and the designer used something that appeared to me like a UISegmentedControl as

How to put an image in the center of navigationBar of a UIViewController?

喜欢而已 提交于 2019-12-02 18:12:26
I have this snippet of code used in viewDidLoad of a UIViewController. I'va no errors. Images exists. I get the background but not the image. Image is a sort of logo. if ([self.navigationController.navigationBar respondsToSelector:@selector(setBackgroundImage:forBarMetrics:)] ) { /* Background of navigationBar. */ UIImage * navigationBarImage = [UIImage imageNamed:@"01_navbar_portrait.png"]; [self.navigationController.navigationBar setBackgroundImage:navigationBarImage forBarMetrics:UIBarMetricsDefault]; /* Image in navigationBar */ UIImage * logoInNavigationBar = [UIImage imageNamed:@"01_logo

Add UIActivityIndicatorView into UIBarButton

早过忘川 提交于 2019-12-02 17:57:54
How do I add a UIActivityIndicatorView spinner circle into a UIBarButton, so that when a user taps on one of those buttons on the navigation bar, they see a spinner while the loading takes place? ferdil If you're trying to show the activity wheel in a navigation bar button (e.g. you might have a refresh button on your navbar) - you can create a new UIBarButtonItem with a custom view being the UIActivityIndicatorView : Objective-C uiBusy = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; uiBusy.hidesWhenStopped = YES; [uiBusy startAnimating];

Hide back button in navigation bar with hidesBackButton in Swift

本小妞迷上赌 提交于 2019-12-02 17:30:50
I want to hide the back button when transitioning from one view to another. I read the questions regarding this problem and every answer was "use hidesBackButton ". The problem with this is: when I put it in viewDidLoad/viewWillAppear the back button arrow hides but the string "Back" doesn't. when I put it in viewDidAppear the back button disappears but it visible to the user How can I fix this? Edit: Here is how you can replicate this problem(or bug?) Make a new Tabbed application with Swift in Xcode. In the FirstViewController.swift use performSegueWithIdentifier to navigate to the second

Change color of UINavigationBar

不问归期 提交于 2019-12-02 17:23:07
问题 Hello, I created UINavigationBar , and I try to change the color bar to aqua color (As in Nib file) How do I do it? 回答1: [[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:0 green:.62 blue:.984 alpha:1]]; Dude, try this to get [UIColor Aqua] throughout your app. 回答2: You can set either tintColor or backgroundImage to your UINavigationBar - (void) viewDidLoad { //set background image [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"background.png"

Custom UINavigationBar with custom height causes the UIBarButtonItem's to be positioned wrong

吃可爱长大的小学妹 提交于 2019-12-02 17:17:49
I created my own subclass of UINavigationBar in order to enable custom background that is taller than 44pxs. I did it by overriding these two methods: -(void) drawRect:(CGRect)rect { [self.backgroundImage drawInRect:CGRectMake(0, 0, self.backgroundImage.size.width, self.backgroundImage.size.height)]; } - (CGSize)sizeThatFits:(CGSize)size { CGRect frame = [UIScreen mainScreen].applicationFrame; CGSize newSize = CGSizeMake(frame.size.width , self.backgroundImage.size.height); return newSize; } And this is the result: Now, my problem as you can see is that all the UIBarButtonItem's (and the

UINavigationController hide only navigationBar - Back animation issue

£可爱£侵袭症+ 提交于 2019-12-02 17:07:21
问题 I have three viewControllers in a UINavigationController . In the second one I need to hide the navigation bar but not the back button and other bar button . For this reason I can't use isNavigationBarHidden = true Currently I am handling the above as follows : First viewController : override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) self.navigationController?.navigationBar.barTintColor = Constants.kThemeRedColor self.navigationController?.navigationBar.tintColor

ios 7 UiView frame issue

时光怂恿深爱的人放手 提交于 2019-12-02 16:37:28
I am running same app in iOS6 and iOS7 which has NavigationBar.It runs well on iOS6, but in iOS7, all view is little bit up like it is not considering the Navigation bar at all. I have tried changing topbar property in simulated metrics option but it doesnt work. It considers button's position from NavigationBar in iOS6, but in iOS7, it considers it from top of the screen. What is the reason for it? Thanks in advance. You should use below line for fix it in your view. self.edgesForExtendedLayout = UIRectEdgeNone; In "iOS 7 UI Transition Guide" for Layout and Appearance one also mentioned - in