uitoolbar

UIBarButtonItem : selected / unselected an item

怎甘沉沦 提交于 2019-12-12 09:26:47
问题 I have a favorite image to display on a UIBarButtonItem , on an toolbar. How do you do to change it when this item is unselected/selected? like this screenshot: Thanks! 回答1: You can make two arrays with UIBarButtonItems: one with the first image and one with the second image. Like this: // array with unselected UIBarButtonItem *unselectedItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"icon_unselected.png"] style:UIBarButtonItemStyleBordered target:self action:@selector

When subclassing UIToolBar to have a custom background the bottom half of toolbar is black?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 03:56:42
问题 I'm subclassing UIToolBar, here is how I override the drawRect method of UIToolBar: - (void)drawRect:(CGRect)rect { UIImage *backgroundImage = [UIImage imageNamed:@"UIToolBar_Background.png"]; [backgroundImage drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; } The app uses a UINavigationController paradigm initialized with initWithNavigationBarClass method. The issue is that the bottom half of toolbar is black? The UIToolBar_Background.png is 44 pixels height (or

UIToolbar in RootViewController

房东的猫 提交于 2019-12-12 03:15:46
问题 I need UIToolbar when my application launches. It will be on every screen through out the application. So for that i have add it in RootViewController . #import "AppDelegate.h" #import "MainViewController.h" @implementation AppDelegate @synthesize window = _window; @synthesize mainViewController = _mainViewController; - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen

How to add a UIToolbar on top of UIPickerView? (iPhone/iPad)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-12 03:13:58
问题 In my app I have a button that when pressed should present a UIPickerView with a UIToolbar on top of it. When the user has selected the value in the UIPickerView they then press a button in the UIToolbar which dismisses both the UIPickerView and UIToolbar . The problem I'm having is that I can't figure out a way to add the UIToolbar to the UIPickerView . Normally I would have a setup where a value in a UITextField is impacted by the selection in the UIPickerView . This way I can simply set

xcode - How can I add a Toolbar to a UITableViewController

心不动则不痛 提交于 2019-12-11 21:12:22
问题 I have a little problem. I wanna add a Toolbar in the button of my UITableViewController, but it doesn't work. Why? 回答1: If your UITableViewController is embedded in UINavigationController , the navigation controller comes with a toolbar. You wouldn't need to add your own. The navigation controller's toolbar is hidden by default. You can enable it by: Checking the Shows toolbar option in the navigation controller Interface Builder attribute inspector pane, or Setting the toolbar visibility in

How to remove/avoid small white splash light on UIBarButtonItem programmatically

丶灬走出姿态 提交于 2019-12-11 15:34:18
问题 My issue is same as question: How to disable the the light that appears when touching a UIBarButtonItem? I have read answer if we use Interface builder. What if I add toolbar programmatically? How can I avoid the light on the bar button item? 回答1: To do what you want programatically you can do UIBarButtonItem *item; UIButton *b2=[[UIButton alloc] initWithFrame:frame]; [b2 addTarget:self action:@selector(settings:) forControlEvents:UIControlEventTouchUpInside]; //you can set the background

iPad. UIBarButtonItem has an undocumented view of type UIToolbarTextButton. Huh?

限于喜欢 提交于 2019-12-11 06:56:22
问题 I have an iPad app where I have a view controller that is the UIGestureRecognizerDelegate for a number of UIGestureRecognizers. I have implemented the following method of UIGestureRecognizerDelegate: - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { // Double tapping anywhere on the screen hides/shows the toolbar if ([gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] == YES) { if (touch.tapCount == 2) { self.toolbar.hidden =

redraw view off screen - contains picker view and tool bar

自作多情 提交于 2019-12-11 04:52:46
问题 Im trying to draw/place a view (which contains a picker view and a toolbar offscreen). On launch the View is still on the screen despite changing its coordinates in viewDidLoad. self.pickerViewContainer.frame = CGRectMake(0, 722, 320, 207); Im using the storyboard. I have created the view in the storyboard, visible in the view controller. I thought i could redraw it off screen as per coordinates above. 回答1: When you use Auto layout write your view's frame related code in viewDidLayoutSubviews

bar button item add toolbar programmatically

孤人 提交于 2019-12-11 02:46:28
问题 I want to add button instead of bar button item into toolbar programmatically. I select it because button has image infodark defaut. so how is this done programmatically? 回答1: UIImage* image = [UIImage imageNamed:defaultImage]; CGRect frame = CGRectMake(0, 0, image.size.width, image.size.height); UIButton* button = [[UIButton alloc] initWithFrame:frame]; [button setTitle:@"Display" forState:UIControlStateNormal & UIControlStateHighlighted]; [button setImage:image forState:UIControlStateNormal

UIBarButtonItems not showing up after creating UIToolbar programmatically?

喜夏-厌秋 提交于 2019-12-11 00:32:02
问题 I'm running across this issue which I can't seem to find the answer to online. Basically what I'm trying to do is programmatically create a UIToolbar with some UIBarButtonItems . What I've done (as detailed below) is create the UIToolbar and then set the items of the UIToolbar to an array holding all the UIBarButtonItems I want. Unfortunately, though the UIToolbar shows up, the UIBarButtonItems have yet to show themselves Any suggestions or explanations as to why this is happening is much