uicontrol

How do I programmatically get the state of UIBarButtonItems?

浪尽此生 提交于 2020-01-05 15:16:51
问题 With a UIControl such as a UIButton you can use something like myControl.state to figure out whether the control is currently being pressed down. However, I need to do the same with some UIBarButtonItems (which are not derived from UIControl ), so that I can stop my table from editing while one of them is pressed down. Here's my code: - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { //other checks for(int b=0; b<self.toolbar.items.count; b++) {

Button changes title every time pressed

和自甴很熟 提交于 2020-01-05 08:55:51
问题 Im trying this, but when i press it it dont changes, it only displays text. Also tried if else functions, but with no results. .h IBOutlet UIButton *poga1; @property (nonatomic, retain) UIButton *poga1; .m @synthesize poga1; - (void)viewDidLoad { [super viewDidLoad]; [poga1 setTitle:@"My Title" forState:UIControlStateNormal]; [poga1 setTitle:@"My Selected Title" forState:UIControlStateSelected]; } 回答1: Try this: If you added a title through the storyboard (the gui interface) then delete it.

Button changes title every time pressed

℡╲_俬逩灬. 提交于 2020-01-05 08:55:26
问题 Im trying this, but when i press it it dont changes, it only displays text. Also tried if else functions, but with no results. .h IBOutlet UIButton *poga1; @property (nonatomic, retain) UIButton *poga1; .m @synthesize poga1; - (void)viewDidLoad { [super viewDidLoad]; [poga1 setTitle:@"My Title" forState:UIControlStateNormal]; [poga1 setTitle:@"My Selected Title" forState:UIControlStateSelected]; } 回答1: Try this: If you added a title through the storyboard (the gui interface) then delete it.

How to add touch event for custom uicontrol and controller?

旧巷老猫 提交于 2020-01-01 19:26:11
问题 I have a custom UIControl that has three subviews. Each of those subviews, I add a target: button.addTarget(self, action: #selector(buttonTapped(clickedBtn:)), for: .touchUpInside) Within that function buttonTapped , it does some special animations to do some transitions (It mimics the segmented control). Now, within the ViewController that this custom UIControl exists in must know when it's touched. I created an @IBAction function that interacts with the touch events for the custom UIControl

Gray out the Desktop screen except a selected control in c#

南楼画角 提交于 2019-12-29 08:08:08
问题 I want to select a UI control to be clicked and gray out the rest of the desktop screen semi-transparently. I was thinking bitmap painting the whole screen but it is very slow process. I guess someone out there know in WPF how to do that. I don't have experiance in WPF. I wanted to do this on Windows 7. 回答1: Basically you want to show a top-level full screen transparent window which is not focusable and doesn't respond to input. You can then use this window to draw the overlay manually. I

MATLAB set background color in a cell of uicontrol

牧云@^-^@ 提交于 2019-12-24 17:02:17
问题 I want to set a background color in a cell.. something like: so I have the RGB color and the number of cell I want to color. you can assume that the position of the cell is what I wrote. my color is given by RGB: color = [255 0 0]; I want to add it in the 10th cell, so I wrote something like: S.cell_data(10) = uicontrol('style','text',... 'units','pix',... 'Position',[20 70 80 40],... 'string',color); but the style is not 'text' and it is no a string. this is what I'm trying right now: S.cell

How to set the button image for UIControlStateSelected

别等时光非礼了梦想. 提交于 2019-12-24 15:27:49
问题 Hi I want to change the background of my button after I press the button i.e. the button should not change back to the previous image. However, I am not able to do so. My code as follows. Can anyone advise how I can change the image to "custom_button_highlight" after I click on the button? UIImage *buttonImageNormal = [UIImage imageNamed:@"custom_button"]; UIImage *stretchableButtonImageNormal = [buttonImageNormal stretchableImageWithLeftCapWidth:12 topCapHeight:0]; UIImage

Is there a blending mode or something else I can set for UIControls so that I can see a layer beneath it?

最后都变了- 提交于 2019-12-24 10:49:30
问题 I have various UIControls added to my view. I'd like to have an image of a gradient show through it like I can with a like a blending mode in Photoshop. Here I used the luminance blending mode. I'm hoping there's something similar that I can access on the layer in Swift. 回答1: I figured out how to do this with the compositingFilter property. I tried this, but had it backwards. It must be used on the image which should be a layer on top of the UIControls: let image: UIImage = UIImage(named:

Adding properties to UIControls without subclassing

不问归期 提交于 2019-12-23 22:18:39
问题 I have embedded UIButtons in my TableViewCells. In order to track which cell the button belongs to, I would like to add an NSIndexPath property to UIButton. I do not want to subclass a UIButton. Is there a way I can do this with categories? EDIT: I believe the idea of setting tags will not work if I have multiple sections in the table view. Another approach of accessing the button's superview's superview to determine the cell seems more like a hack. Looking for a cleaner way of doing this.

Detect on calloutAccessoryControlTapped only the tap on rightCalloutAccessoryView

拈花ヽ惹草 提交于 2019-12-23 07:03:37
问题 My calloutAccessoryControlTapped is also called when I just tap on annotation view and this behavior it's right. But how can I detect if the user has tapped on the right accessory view (in my case a detail disclosure button) and not just in the view? I added a simple check but it doesn't work. import UIKit import MapKit extension MapVC: MKMapViewDelegate, CLLocationManagerDelegate { func mapView(mapView: MKMapView, annotationView view: MKAnnotationView, calloutAccessoryControlTapped control: