uinavigationbar

UISegmentedControl in the Navigation Bar with the Back button

Deadly 提交于 2019-12-03 07:15:31
问题 I'm adding a UISegmentedControl to the Navigation bar programatically where the titleView should be. But as Apple docs have mentioned under titleView , This property is ignored if leftBarButtonItem is not nil . But I want to have the back button as well. Like they have illustrated in their own images! Below is the code I add the UISegmentedControl . self.navigationItem.leftBarButtonItem = nil; UISegmentedControl *statFilter = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects

Adding left button to UINavigationBar (iPhone)

隐身守侯 提交于 2019-12-03 06:40:35
问题 I've created a new navigation based iPhone app. I added this to the RootViewController. - (void)viewDidLoad { [super viewDidLoad]; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] init]; self.navigationItem.leftBarButtonItem = addButton; self.navigationItem.leftBarButtonItem.enabled = YES; } No left button displays however. Is there something I need to do? 回答1: You don't define what the button actually does. This is a line from my app: self.navigationItem.leftBarButtonItem = [

Custom UINavigationController UINavigationBar

一笑奈何 提交于 2019-12-03 06:25:28
问题 Basically I want a custom UINavigationBar . I don't want it to be "translucent" or anything, like the pictures app. I basically want to completely remove it, but I still want to be able to add back buttons and such when navigation controllers are pushed, and I want the views (EG: UITableViewController ) to be pushed down below it. Like this: Any ideas how to achieve this at all? Thanks 回答1: @implementation UINavigationBar (background) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage

Create NavBar programmatically with Button and Title Swift

人走茶凉 提交于 2019-12-03 05:40:44
问题 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

How to properly build a navigation menu that highlights the current page

◇◆丶佛笑我妖孽 提交于 2019-12-03 05:11:53
I've setup a menu for a fairly simple site based on icant.co.uk . It's fairly simple with maybe 5 pages. The small site is mainly a mysql browser for a few tables using MATE . Theres a common.php file that contains the header & footer HTML so thats where I put the code below. The code below highlights the current page on the menu. Its ugly and I'm sure there has to be a better way to do it. Any help is appreciated, thank you! heres my code <?php $currentFile = Explode('/', $_SERVER["PHP_SELF"]); $currentFile = $currentFile[count($currentFile) - 1]; if ($currentFile == "orders.php"){ echo '<li

UINavigationContoller interactivePopGestureRecognizer inactive when navigation bar is hidden

折月煮酒 提交于 2019-12-03 05:02:30
问题 I have a view controller which is nested within a UINavigationController . I have implemented the iOS 7 interactivePopGestureRecognizer to enable the user to gesture to pop a VC off the stack. Within the VC i have a scrollview and whilst the user is not at the top of the scrollview I hide all the chrome (Navigation bar and status bar) to place focus on the content. However with the navigation bar hidden, the interactivePopGestureRecognizer is not working. I have tried enabling it after it has

iOS7: UICollectionView appearing under UINavigationBar

落爺英雄遲暮 提交于 2019-12-03 05:02:26
问题 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

Add UIActivityIndicatorView into UIBarButton

北城余情 提交于 2019-12-03 04:46:13
问题 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? 回答1: 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]

Centering Label Vertically in UINavigationBar TitleView

本秂侑毒 提交于 2019-12-03 04:16:51
I'm not having much luck centering vertically the label I'm adding to the TitleView on the UINavigationBar . You can see what it looks like below. This is how I'm adding the label: UILabel *titleLabel = [[UILabel alloc] init]; titleLabel.text = NSLocalizedString(@"activeSessionsTitle",@""); titleLabel.font = [Util SETTING_NEO_HEADER_FONT]; titleLabel.textColor = [UIColor whiteColor]; titleLabel.backgroundColor = [UIColor clearColor]; titleLabel.textAlignment = UITextAlignmentCenter; titleLabel.shadowColor = [UIColor colorWithRed:0.0f/255.0f green:0.0f/255.0f blue:0.0f/255.0f alpha:0.25f];

How do I get the width of the back button in a UINavigationBar?

Deadly 提交于 2019-12-03 04:06:36
We have a controller that might be pushed from several places, so its back button might have one of several titles. It also has a button that pops up another controller. They both have the same custom title element, but they're centred differently because the second controller has no back button. I'd like to add a spacer to fix this, but I don't know what width to make it. How do I get the width of the back button in a UINavigationBar? You could always spelunk through the navigation bar's subviews, looking for the back button view and picking off the size when you find it. I did a blog post a