uitoolbar

ToolBar at the top of UIPIckerView in xcode?

笑着哭i 提交于 2019-12-18 08:23:51
问题 I need to add a toolbar with done button on the top of UIPickerView . I don't want to use actionSheet because I want the rest of the view to be active. I've gone for the following code: - (BOOL)textFieldDidBeginEditing:(UITextField *)textField { [txtstate resignFirstResponder]; pickerView = [[UIPickerView alloc]init] ; pickerView.frame=CGRectMake(10, 75, 180,20); pickerView.delegate = self; pickerView.showsSelectionIndicator = YES; UIToolbar* toolbar = [[UIToolbar alloc] init]; toolbar.frame

How to programmatically replace UIToolBar items built in IB

旧巷老猫 提交于 2019-12-17 22:25:46
问题 I have a toolbar with various image buttons, created in Interface Builder. I'd like to be able to programmatically replace one of the buttons with an activity indicator when pressed, and then put back the original button but change its color from white to yellow when the activity completes. Is this possible with an IB built toolbar or must I look at building the whole toolbar programmatically and custom views? 回答1: Here is an example of what I did in a similar situation. I wanted to build the

Custom background image on UIToolbar in IOS5 SDK

[亡魂溺海] 提交于 2019-12-17 21:51:20
问题 Downloaded IOS5 SDK yesterday, and this code which I use to set my UIToolbar's background to a custom image stopped working. If I set the target to IOS4.3 and below it still works. [self.bizToolbar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"navbar-iphone.png"]] autorelease] atIndex:0]; Anybody encountered this yet on IOS 5? 回答1: You can use: [[UIToolBar appearance] setBackgroundImage:toolBarIMG forBarMetrics:UIBarMetricsDefault]; (new in iOS 5) 回答2: Suppose you

UIToolbar tint on iOS 4

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 18:33:22
问题 just switched to iOS 4 on my iPhone 3GS and some of my apps broke. One issue I had is that I had a UIToolbar with some buttons, tinted to pink, that worked well on the 3.1.3 OS. After upgrading to iOS 4, the toolbar was still tinted, but the buttons it contained were no longer affected by the tint. The toolbar was pink while the buttons were regular-blue. Looked around for it on the net, but found no reference of such a thing. Anyone knows what broke in the process? 回答1: (must be frank here -

How to hide the navigation bar and toolbar as scroll down? Swift (like myBridge app)

爷,独闯天下 提交于 2019-12-17 17:26:52
问题 I want to hide a toolbar and nav bar as I scroll down a page. And return it as I scroll up. How is this possible? How would I go about detecting the drag? Do I use pan gesture or is this down with the scrollview? 回答1: Try this simple approach: Tested in Swift 3 func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { if(velocity.y>0) { //Code will work without the animation block.I am using animation block

How to add a UIToolbar programmatically to an iOS app?

吃可爱长大的小学妹 提交于 2019-12-17 15:37:28
问题 Can't seem to find a tutorial which does as the question title describes. I'd like to understand just where the UIToolbar needs to be declared and how to get it onto my view layer. 回答1: UIToolbar is a subclass of UIView , so the short answer to your question is: just like any other view. Specifically, this is an example of how to programmatically create a toolbar. The context in this snippet is viewDidLoad of a view controller. UIToolbar *toolbar = [[UIToolbar alloc] init]; toolbar.frame =

How do I show/hide a UIBarButtonItem?

岁酱吖の 提交于 2019-12-17 05:33:22
问题 I created a toolbar in IB with several buttons. I would like to be able to hide/show one of the buttons depending on the state of the data in the main window. UIBarButtonItem doesn't have a hidden property, and any examples I've found so far for hiding them involve setting nav bar buttons to nil, which I don't think I want to do here because I may need to show the button again (not to mention that, if I connect my button to an IBOutlet, if I set that to nil I'm not sure how I'd get it back).

Is there a way to change the height of a UIToolbar?

给你一囗甜甜゛ 提交于 2019-12-17 04:45:17
问题 I've got an UIToolbar in Interface Builder and I've noticed that it's locked to being 44px tall. Of course I'd like to make this larger. Does Apple allow resizing of this control? If so, how do I go about it? 回答1: Sure, just set its frame differently: [myToolbar setFrame:CGRectMake(0, 50, 320, 35)]; This will make your toolbar 35 pixels tall. Of course this requires an IBOutlet or creating the UIToolbar programmatically, but that's very easy to do. 回答2: If that does not work in SDK 6, it is

How can I add a toolbar above the keyboard?

蓝咒 提交于 2019-12-17 04:44:30
问题 I have created a UIToolBar programmatically and added a UITextField on it. Now, I need that toolbar to be above the keyboard when I click in another text field. UIToolbar *toolBar=[[UIToolbar alloc]initWithFrame:CGRectMake(0,400, 320, 60)]; [self.view addSubview:toolBar]; UITextField *txtView=[[UITextField alloc]initWithFrame:CGRectMake(0, 400, 260, 30)]; txtView.backgroundColor =[UIColor grayColor]; txtView.placeholder=@"Address"; UIBarButtonItem *txtfieldItem=[[UIBarButtonItem alloc

Change background image of UIToolbar

自闭症网瘾萝莉.ら 提交于 2019-12-14 00:29:16
问题 How can I change the background image of UIToolbar? I have been able to do this for navigation bar, but not UIToolbar. I do not want to change tintColor. I would like to change the whole image. Thanks for your help. 回答1: From Can I give a UIToolBar a custom background in my iPhone app? Overriding the drawRect function and creating an implementation of the UIToolbar does the trick :) @implementation UIToolbar (CustomImage) - (void)drawRect:(CGRect)rect { UIImage *image = [UIImage imageNamed: @