uinavigationitem

Placing a custom view based UIBarButtonItem in the navigation bar without default horizontal padding

妖精的绣舞 提交于 2019-11-29 22:48:40
How do I remove the horizontal padding to the left and right of custom left and right UINavigationBar items? There seems to be ~ 10 points of padding that iOS sets by default. I'm customizing left and right navigation bar buttons (I have given up on trying to set my own backButtonItem, so I'm just using the leftBarButtonItem). In either case (left or right), pressing these custom buttons indicates that Apple seems to preserve some padding to the left of the leftBarButtonItem, and to the right of the rightBarButtonItem; regardless of how wide I make the custom background and image properties of

How to add custom view on right of navigation bar Swift?

六月ゝ 毕业季﹏ 提交于 2019-11-29 22:40:33
问题 I am trying to add a custom view on right of UINavigationBar . What I tried is the following, but the view is not showing up! Please help, thanks in advance! let viewOnrightButton = UIView(frame: CGRect(x: 2, y: 2, width: 60, height: 22)) // viewOnrightButton.frame = CGRectMake(2, 2, 60, 22) viewOnrightButton.layer.cornerRadius = 2 viewOnrightButton.backgroundColor = UIColor(red: 0.961, green: 0.827, blue: 0.239, alpha: 1.00) lblNumbersOfBanana.frame = CGRectMake(2, 1, viewOnrightButton.frame

UINavigationItem centering the title

ぃ、小莉子 提交于 2019-11-29 21:47:00
I have a navigationBar with both Left and Right bar buttons on each side. I have a customTitlelabel which I set as the titleView of the UINavigationItem . [self.navigationItem setTitleView:customTitleLabel]; All is fine now. The problem, the size of the rightbarButton is dynamic based on the input I get in one of the text fields. Therefore the title is automatically centered based on the available space between the buttons. how can i set the title to a fixed position? You can't do what you want directly -- the position of your title view is out of your control (when managed by UINavigationBar

iPhone Title and Subtitle in Navigation Bar

試著忘記壹切 提交于 2019-11-29 20:59:34
In my application, I'd like to have the navigation bar display a title and subtitle. To that extent, I added the following code to my view controller: // Replace titleView CGRect headerTitleSubtitleFrame = CGRectMake(0, 0, 200, 44); UIView* _headerTitleSubtitleView = [[[UILabel alloc] initWithFrame:headerTitleSubtitleFrame] autorelease]; _headerTitleSubtitleView.backgroundColor = [UIColor clearColor]; _headerTitleSubtitleView.autoresizesSubviews = YES; CGRect titleFrame = CGRectMake(0, 2, 200, 24); UILabel *titleView = [[[UILabel alloc] initWithFrame:titleFrame] autorelease]; titleView

how to add items in uinavigationbar at a specific position?

只愿长相守 提交于 2019-11-29 16:38:12
I am developing one application for iphone and in that i have some issues regarding adding more then one UILabel in navigation bar at a specific position. What i want is in following images in above image there is one backbar button and one imageview as shown with arrow-mark. Other then that all white box is for difrent UILabels to show in navigation bar. There is only one UIImageView in the navigation bar and one left bar button. Now problem is that i don't know how to add multiple UILabel in navigation bar at a specific position. Till now what i have worked is to add only button and

UIButton in Navigation Bar Not Recognizing Taps in iOS 11

∥☆過路亽.° 提交于 2019-11-29 07:05:52
I have a UIButton in a navigation bar that sits over the top of a UIImage and a UILabel . It worked fine in iOS 10, but now in iOS 11 it doesn't recognize any taps from my @IBAction outlet. I tried moving the tap outlet to the bar button item, but that didn't work either. The UIButton has the following constraints: I confirmed that it's there by giving it a green background, so I know it's visible and available. Any idea what's going on? I found a solution from another developer. You have to add width and height constraints to the view that wraps all your stuff inside the bar button item. So

How to add custom view on right of navigation bar Swift?

非 Y 不嫁゛ 提交于 2019-11-29 04:59:26
I am trying to add a custom view on right of UINavigationBar . What I tried is the following, but the view is not showing up! Please help, thanks in advance! let viewOnrightButton = UIView(frame: CGRect(x: 2, y: 2, width: 60, height: 22)) // viewOnrightButton.frame = CGRectMake(2, 2, 60, 22) viewOnrightButton.layer.cornerRadius = 2 viewOnrightButton.backgroundColor = UIColor(red: 0.961, green: 0.827, blue: 0.239, alpha: 1.00) lblNumbersOfBanana.frame = CGRectMake(2, 1, viewOnrightButton.frame.width-20, 20) lblNumbersOfBanana.text = "001" var bananaImgView = UIImageView(frame: CGRect(x:

UINavigationItem Back Button touch area too large

笑着哭i 提交于 2019-11-29 04:47:13
On this following screenshot, if I click on "v" from "Available Kiosks" this is launching the action of the back button... (not with the second "a"). I don't understand why, I've nothing special in my code (this is the default backbutton handled by the navigation controller). I also have the same bug with another application I did but I never notice this on others applications. Any Ideas ? Thank you. That's not a bug, it does the same in Apple apps, and even on some (many / all ?) buttons. It's the behaviour of touch events on buttons : the area of the touch is larger than the button bounds. I

iPhone: UINavigationBar with buttons - adjust the height

爱⌒轻易说出口 提交于 2019-11-29 03:24:26
问题 I am working on an iPhone application which works in both orientations: portrait and landscape. I am using for one view and tableview embedded in an UINavigationController. The height of this navigationbar with its buttons is either: 44px portrait or 34px landscape. Within a different view I created the UINavigationBar by myself and I am able to set the frame for the correct size, but the embedded UINavigationItem with UIBarButtonItem doesn't shrink. So for the 34 px in the landscape mode

UISegmentedControl embedded in a UINavigationBar/Item

偶尔善良 提交于 2019-11-28 20:38:37
问题 I would like to embed a UISegmentedControl somewhere in my UINavigationController s topbar. It is no problem embedding it in a UIBarButtonItem and setting it as the left or right barButtonItem. I can understand this approach when dealing with the screen real-estate of an iPhone. I am, however, doing this in a Popover on an iPad and there is "lots" of vertical space available in the topbar. If I add the segmentedControl as a left or right barButtonItem it gets scaled down so that I can not see