uibarbuttonitem

navigation bar right bar button items spacing

浪子不回头ぞ 提交于 2019-12-02 18:07:36
I have created a with left bar button item added from storyboard, titleView and three right bar button items from code. Here is the code: override func viewDidLoad() { super.viewDidLoad() var screenWidth = UIScreen.mainScreen().bounds.width // custom title view var navBarWidth: CGFloat = self.navigationController!.navigationBar.frame.size.width let customTitleView = UIView(frame: CGRectMake(0, 0, navBarWidth, 44)) titleLabel = UILabel(frame: CGRectMake(20, 0, navBarWidth, 40)) titleLabel.text = conversationName if let titleFont = UIFont(name: "Roboto-Regular", size: 20) { titleLabel.font =

Add UIToolBar to all keyboards (swift)

若如初见. 提交于 2019-12-02 17:37:53
I'm trying to add a custom UIToolBar to all of my keyboards with as little repetition. The way I'm currently doing it requires me to add the code to all my viewDidLoads and assign every textfield's delegate to the viewController I'm using. I have tried creating my own UIToolBar subclass but I find that I can't really do that when the target for my "Done" and "cancel" buttons are the self view. Does anyone have any suggestions for creating an easily reusable toolbar? Thanks in advance. override func viewDidLoad() { super.viewDidLoad() var toolBar = UIToolbar() toolBar.barStyle = UIBarStyle

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

How to add 2 buttons on navigation bar?

我是研究僧i 提交于 2019-12-02 14:36:16
问题 I am using Split View Controller , which has 2 View controllers on the second view controller i am suppose add two buttons on the right side of navigation controller. i have used the following code to add one button which works: UIBarButtonItem *barButton=[[UIBarButtonItem alloc] init]; [barButton setCustomView:btnShare]; self.navigationItem.rightBarButtonItem=barButton; tried this link http://osmorphis.blogspot.in/2009/05/multiple-buttons-on-navigation-bar.html but could not succeed.Please

how to send email using UIbarbuttonitem without using MFMailComposerViewController

喜你入骨 提交于 2019-12-02 13:04:39
问题 I want to send email using rightBarButtonItem without using MFMailComposerViewController. Is It possible to send email using barButtonItem? Any Idea how to do this? thanx in advance. 回答1: You'll find a fantastic code sample on the accepted answer here to send a background email: Locking the Fields in MFMailComposeViewController All you need to do is setup your rightBarButtonItem's target to fire a method containing this email code, and then populate the message contents etc using the

Creating nib view from UIBarButtonItem?

僤鯓⒐⒋嵵緔 提交于 2019-12-02 12:30:43
So I've seen previous questions similar to this but they were of no help. I've read Apple's documentation too but I could not understand where I've gone wrong. AFAIK I did everything logically, but when I click on my done button on an UIToolbar overlay, the button can be pushed but it does not do anything. This obviously means it fails to acknowledge the written code. But how? I want to bring up the .nib of "TableViewController" when a done button is clicked on my UIToolbar . But the below isn't allowing the click to bring up a new view. How do I rectify this? Please show me where I went wrong

How to add barbutton programmatically with image

吃可爱长大的小学妹 提交于 2019-12-02 11:32:53
问题 I am creating a barbutton programmatically. But it can't fix into screen. Help me in solve this problem. Screenshot: UIImage *image = [UIImage imageNamed:@"request.png"]; UIBarButtonItem *button2; //[button2 setWidth:55]; button2= [[UIBarButtonItem alloc] initWithImage:image style:UIBarStyleDefault target:self action:@selector(requestButton)]; self.navigationItem.rightBarButtonItem = button2; [button2 release]; 回答1: UIImage *image = [UIImage imageNamed:@"request.png"]; UIButton* requestButton

Setting a UIImage to a UIBarButton item

南笙酒味 提交于 2019-12-02 08:29:18
I can't seem to add an image to this UIBarButtonItem without it crashing when touched: UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = backButton; [backButton release]; this code adds an image, but it crashes when touched because of an incompatible pointer types assigning to UIBarButtonItem * from UIButton: //Setup Custom Button UIButton *button = [[UIButton alloc] init]; button.frame = CGRectMake(0,0,44,44); // [button addTarget:self action:@selector(showInfo)

Displaying notification badge like counter in UINavigationbar

我的未来我决定 提交于 2019-12-02 05:56:47
I have a requirement to display number of pending notifications in iPhone navigation bar. The appearance should be like that of notification badge - but these are not APNS notifications. They are the ones sent from private server with similar purpose. I tried adding a right/left button ( UIBarButtonItem ) in my UINavigationbar but it seems like it is very rigid in appearance. I can't set its width, fonts etc. See my code: self.notifButton = [[UIBarButtonItem alloc] initWithTitle:@"0" style: UIBarButtonItemStyleBordered target:self action:@selector(TouchNotif)]; NSMutableArray *items = [

how to send email using UIbarbuttonitem without using MFMailComposerViewController

旧街凉风 提交于 2019-12-02 04:31:14
I want to send email using rightBarButtonItem without using MFMailComposerViewController. Is It possible to send email using barButtonItem? Any Idea how to do this? thanx in advance. Luke You'll find a fantastic code sample on the accepted answer here to send a background email: Locking the Fields in MFMailComposeViewController All you need to do is setup your rightBarButtonItem's target to fire a method containing this email code, and then populate the message contents etc using the information you want to send. Hope this helps! Zeroed In Set an action method for the right bar button item and