Initialize a button with a title of a tag in swift

I want to initialize a button's title from a Label. I have this code: let smallSquare = CGSize(width: 30, height: 30) let button = UIButton(frame: CGRect(origin: CGPointZero, size: smallSquare)) But, I do not know how I can initialize a title with my

How to activate an InputView using a UIButton in Swift?

I am attempting to have a UIDatePicker come up as a keyboard when the user hits a UIButton. I was able to get it to work with a textfield, but I don't like how the cursor is visible and the user could enter in any text if they had an external keyboar

How to pass the EAGLView UIButton frame to viewcontroller

I have EAGLView and it's UIButton. In ViewController i need to display the same button in landscape mode with click event what it has in EAGLView. I tried to set [ setFrame:CGRectMake(360, 10, 40, 40)]; but the size is not changing in la

UIButton Enable / Disable No Work

UIButton enable not working after Xcode Update to Xcode 5.0.1. self.btn.enabled = NO; self.btn.hidden = NO; Please suggest.You should probably check the following in your project : Checklist Make sure that the button btn is connected to the relevant

Changing the UIButton image in multiple UITableViewCells

I am currently building an iOS app that uses a UITableView with custom UITableViewCells that include a button. What I want to accomplish is having the UIButton's image change on touch up inside. That part is working fine, the issue is when you scroll

UIButton with rounded corners and border

I want to set border on UIButton and rounded corners ONLY in one side I use this code: //set rounded corners on top UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.scanButton.bounds byRoundingCorners:(UIRectCornerTopLeft | UIRec

Custom iOS tag for UIButton

Since I have many buttons that call the same target method I need to store additional information to every UIButton. Integer tag is not enough for me as I need to save at least two integers values. I have many buttons with the same target: [button ad

Replacing the UIButton title with each press

I would like to present to the user with each press of the button different letter from the ABC. So when it first click on the application the user will see the letter A, then they will need to press the button and then they will see the letter B and

add an additional element in the Collection Collection View

I am having one array which is having 10 element. which I am able to set as item in Collection view. Now I want to add 11th element, which will be one button. How can I do that?The way I did this was to make collectionView:numberOfItemsInSection: ret

Can I plant my application on my own?

iOS APP question I have a special case that I want There is a Button , and when it onClicked,the APP will crash itself (on control) Example [btn addTarget:self action:@selector(noThisMethod) forControlEvents:UIControlEventTouchUpInside]; it's simply

Resizing UIButton to fit the length of the text

There are a number of posts on Stack about this subject but I can't get any to work. I have a Button whose text literal is supplied by a variable which can change in length. I want the button to be sufficiently long so the text is readable rather tha

How to clear the contents of the subview before drawing

i use two blocks to draw some buttons on my subview dynamically. One calculates frames for Portrait mode and the other does for Landscape. It works well but when i rotate, it writes over the old ones. Hence, some of my buttons come twice. Here is my

How to make a UIButton look like an email link button?

I am new in iPhone development. Am doing a contact us page. Here I want to add a email link and also I want to open the iPhone's default mail app while clicking that link. I don't know how to make the UIButton looks like a link button. How can I achi

UIView alpha = 0 causes spillover on the view below

So I created a glass pane or a custom UIView to handle touches. This glass pane sits on top of other views such as dummy UIButtons. When I set the alpha to be 0, the touches actually get intercepted by the views underneath the glass view. This is wro

define the image of UIButton by random array of images

I need your help as I dont know how can I set the background image of my UIButtons from array of images. I have 10 UIButtons and an array of 10 images. I want to set the images from array randomly. Please tel me how this can be possible.This may need

UIButton Background image Modify by program

How can I change the background image of my UIButton in click event? And refresh it in a few second with the previous image? I mean change it's background image on click and reset it after the click. [yourButton setImage:[UIImage imageNamed:@"yourNor

C # Winforms: Programmatically Show Hover State Buttons

i am displaying a numeral keypad in on a winform to enter code. i am displaying nummpad with buttons... The users will be using only keyboards numpad to enter the code\password\? but off-course you can use mouse... If we use mouse to click button we

giving a margin of text / padding to the UiButton on the Iphone

I have the following layout, and I'm trying to add a padding to the left and right.. the controls are some disabled Uibutton. My code for creating a button is this: UIButton *buttonTime = [[UIButton alloc] initWithFrame:CGRectMake(90, 10, 50, 20)]; [

UIBarButton Type as UIButton. Not on a navigation bar!

I would like to use the better styled UIBarButtonType as a typical UIButton. This is just to use on a view not a navigationBar. I don't really want to recreate the button in an image app and apply to the various states. I know how to do it the other

Is there an automatic version with setTitle (UIButton class)?

As everyone knows, setTitle automatically retains the string passed as a parameter. When the button caption needs to be changed, I guess that it is necesary to release the current (old) string before setting the new one. I wonder what is the most ele

UINavigationItem persistent rightBarButtonItem property

This may be a stupid question, but is it possible to keep a right UIBarButtonItem across multiple views managed by a UINavigationController? I have a progression of views that often share the same right UIBarButtonItem, but when I push a new view to