Search Results

Search found 447 results on 18 pages for 'uibutton'.

Page 3/18 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • UIButton as a subview in UILable

    - by Jayshree
    hi. i am trying to dynamically add a UIbutton as a subview to UIlable. but i am not able to click the button. it seems that the lable doesnt allow the buttonTapped event to occur. can somebody explain what exactly is happening here. and can anybody give me an alternative for this. thnx

    Read the article

  • UIButton as a subview in UILabel

    - by Jayshree
    hi. i am trying to dynamically add a UIbutton as a subview to UIlable. but i am not able to click the button. it seems that the lable doesnt allow the buttonTapped event to occur. can somebody explain what exactly is happening here. and can anybody give me an alternative for this. thnx

    Read the article

  • UIButton does not respond to touch events after changing its position using setFrame

    - by Pranathi
    I have a view controller class (child) which extends from view controller class (parent). In the parent class's loadView() method I create a sub-view (named myButtonView) with two buttons (buttons are horizontally laid out in the subview) and add it to the main view. In the subclass I need to shift these two buttons up by 50pixels. So, I am shifting the buttonView by calling the setFrame method. This makes the buttons shift and render properly but they do not respond to touch events after this. Buttons work properly in the views of Parent class type. In the child class type view also, if I comment out the setFrame() call the buttons work properly. How can I shift the buttons and still make them respond to touch events? Any help is appreciated. Following is snippets of the code. In the parent class: - (void)loadView { // Some code... CGRect buttonFrameRect = CGRectMake(0,yOffset+1,screenRect.size.width,KButtonViewHeight); myButtonView = [[UIView alloc]initWithFrame:buttonFrameRect]; myButtonView.backgroundColor = [UIColor clearColor]; [self.view addSubview:myButtonView]; // some code... CGRect nxtButtonRect = CGRectMake(screenRect.size.width - 110, 5, 100, 40); myNxtButton = [UIButton buttonWithType:UIButtonTypeCustom]; [myNxtButton setTitle:@"Submit" forState:UIControlStateNormal]; myNxtButton.frame = nxtButtonRect; myNxtButton.backgroundColor = [UIColor clearColor]; [myNxtButton addTarget:self action:@selector(nextButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; [myButtonView addSubview:myNxtButton]; CGRect backButtonRect = CGRectMake(10, 5, 100, 40); myBackButton = [UIButton buttonWithType:UIButtonTypeCustom]; [myBackButton setTitle:@"Back" forState:UIControlStateNormal]; myBackButton.frame = backButtonRect; myBackButton.backgroundColor = [UIColor clearColor]; [myBackButton addTarget:self action:@selector(backButtonPressed:) forControlEvents:UIControlEventTouchUpInside]; [myButtonView addSubview:myBackButton]; // Some code... } In the child class: - (void)loadView { [super loadView]; //Some code .. CGRect buttonViewRect = myButtonView.frame; buttonViewRect.origin.y = yOffset; // This is basically original yOffset + 50 [myButtonView setFrame:buttonViewRect]; yOffset += KButtonViewHeight; // Add some other view below myButtonView .. }

    Read the article

  • UIButton doesn't listen to content mode setting?

    - by Dan Ray
    firstButton is a UIButton of type Custom. I'm programmatically putting three of them across each cell of a table, thusly: [firstButton setImage:markImage forState:UIControlStateNormal]; [firstButton setContentMode:UIViewContentModeScaleAspectFit]; [cell.contentView addSubview:firstButton]; Elsewhere, I'm telling it to clipToBounds. What I get is a crop of the center square of the image, rather than an aspect-scaled rendering of it. I've tried this lots of ways, including setting the mode property on firstButton.imageView, which also doesn't seem to work.

    Read the article

  • UIButton not firing selector if I draw it using CALayer

    - by Horatiu Paraschiv
    Hi everybody I create this button like this: _myButton = [[UIButton buttonWithType:UIButtonTypeCustom] retain]; DLBadgeLayerDelegate *layerDelegate = [[DLBadgeLayerDelegate alloc] init]; _myButton.frame = CGRectMake(0.0 , 0.0, 100.0, 100.0); [_myButton addTarget:self action:@selector(myButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; _myButton.layer.backgroundColor = [[UIColor redColor] CGColor]; _myButton.center = CGPointMake(10.0, 10.0); [self addSubview:_myButton]; [_myButton release]; The button appears on the screen but if I tap on it nothing happens. If I just create a Rounded rect button instead with no custom drawing on its layer or if I just leave the layer line of code out all works well. Do you have any Idea why do I get this behaviour as I would like to do some custom drawing in the button's layer?

    Read the article

  • UIButton Origin and Device Orientation

    - by Ward
    Hey there, I might be crazy, but for some reason this problem is stumping me. I have a view controller that is set to auto rotate to orientation. Inside I've got two subviews. One is a uibutton. All I want is for my button's origin to stay locked to the bottom-left in portrait and bottom-right in landscape (so it basically stays in the same place). It should also stay in place for portrait upside down and landscape right. Any ideas? Thanks, Howie

    Read the article

  • Uibutton events

    - by Raju
    //My Button code --------------------------------------------------------------------------------------------------- UIButton *ticketButtonObj=[[ticketButton alloc]initWithFrame:CGRectMake(0.0f, 115.0f, 500.0f, 40.0f) ; int col=10; [ticketButtonObj addTarget:self action:@selector(ShowNumber:) forControlEvents:UIControlEventTouchUpInside]; [self.window addSubview:ticketButtonObj]; -(void) ShowNumber:(id)sender{ // here i want to get the Value of Col } in the above code when i pressed the button.. i want print the value of col variable in ShowNumber method .. how it is ? pls Help me ... thanks and regards... by raju

    Read the article

  • UIButton to be resized

    - by Sathiya
    I am using a UIButton in my application. This button title is displayed dynamically as per the user choice. Now i have to resize the button width as per the title content. I am calculating the string length and assigning it to button's width. the button is resized as per title but the problem is as follows, 1. If at first the title with large content is shown and after that if a title with a small content is shown means the button is overwritten it doesn't remove the previously constructed value. 2. it looks as if one button is overlapped on the another.

    Read the article

  • How to use UISwipeGestureRecognizer on UIButton?

    - by Ashutosh
    I have a UIbutton which i want to work as a joystick. So i am trying to add some gesture recognizer on the same button. I have this in my code right now: UISwipeGestureRecognizer *recognizer; recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; [recognizer setDirection:(UISwipeGestureRecognizerDirectionUp)]; [self.gestureRecieverButton addGestureRecognizer:recognizer]; [recognizer release]; recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipeFrom:)]; [recognizer setDirection:(UISwipeGestureRecognizerDirectionDown)]; [self.gestureRecieverButton addGestureRecognizer:recognizer]; [recognizer release]; -(void)handleSwipeFrom:(UISwipeGestureRecognizer *)recognizer { NSLog(@"Swipe received.%@",recognizer); } This is the error i am getting now: -[CUETutorialSixteenClusterRootController handleSwipeFrom:]: unrecognized selector sent to instance 0x79b71b0 2012-03-28 13:25:55.724 CUETrainer[1788:11f03] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CUETutorialSixteenClusterRootController handleSwipeFrom:]: unrecognized selector sent to instance 0x79b71b0' But its not actually doing anything. Please help!!!!

    Read the article

  • How to animate a UIButton selected background Image

    - by Thomas Joos
    hi all, I have a class defining a custom UIButton. I configurate a normal and selected state like this: //custom image UIImage *image = [UIImage imageNamed:@"customIconCreationBG.png"]; UIImage *stretchImage = [image stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; [self setBackgroundImage:stretchImage forState:UIControlStateNormal]; UIImage *imageSelected = [UIImage imageNamed:@"customIconCreationBG_selected.png"]; UIImage *stretchImageSelected = [imageSelected stretchableImageWithLeftCapWidth:0.0 topCapHeight:0.0]; [self setBackgroundImage:stretchImageSelected forState:UIControlStateSelected]; In another class I'm filling an array with custom buttons and i'm adding a button pressed method. It sets the selected state to TRUE -(void)buttnPressed:(id)sender { NSLog(@"button pressed"); [[NSNotificationCenter defaultCenter] postNotificationName:@"unselectBGIcons" object:self]; HorizontalListIcon *pressedIcon = ((HorizontalListIcon *)sender); [pressedIcon setSelected:TRUE]; } The button switches to another background, which is great. Is there a way to animate this change ( fading in? ) because it's a bit hard now. Greets

    Read the article

  • How Do I Bind a UIButton Property to Another Property?

    - by cygnl7
    UIButton eventually inherits from NSObject, and NSObject implements NSKeyValueBindingCreation Protocol. So why can't I bind a UIButton's property to another class' property? [myUIButton bind:@"enabled" toObject:myOtherObject withKeyPath:@"otherObjectBOOLProperty" options:nil]; This results in the warning 'UIButton' may not respond to '-bind:toObject:withKeyPath:options:' What I'm trying to do is bind the enabled state of my UIButton to myOtherObject.otherObjectBOOLProperty.

    Read the article

  • Custom UIButton for Iphone.

    - by Amal
    I have an view in my App which has a number of buttons based on the number of items returned by the server. So if the server returns say 10 items, there should be 10 buttons and clicking on each button should call a different person. For the above purpose I created a custom button class deriving from UIButton. @implementation HopitalButton @synthesize index; @synthesize button_type; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { UIImage* img = [UIImage imageNamed:@"dr_btn.png"]; [img stretchableImageWithLeftCapWidth:10 topCapHeight:10]; [self setBackgroundImage:img forState:UIControlStateNormal]; [self setTitleColor:[UIColor colorWithRed:0.698 green:0.118 blue:0.376 alpha:1] forState:UIControlStateNormal] ; [self setFont:[UIFont fontWithName:@"Helvetica Bold" size:13]]; self.titleLabel.textColor = [UIColor colorWithRed:178 green:48 blue:95 alpha:1]; self.adjustsImageWhenHighlighted = YES; } return self; } - (void)dealloc { [super dealloc]; } @end Now the problem with the above code is that it does not create buttons that look similar to the buttons created by default in Interface builder. The borders are missing. And I create buttons of the above type by the following code: HopitalButton* hb = [[HopitalButton alloc] init]; hb.button_type = @"call"; hb.frame = CGRectMake(50, 50 + i * 67, 220, 40); [self.scroll_view addSubview:hb]; [hb setTitle:[[[self.office_full_list objectAtIndex:i] objectForKey:@"Staff" ]objectForKey:@"FullName"] forState:UIControlStateNormal]; hb.index = [NSNumber numberWithInt:[self.button_items count]]; [self.button_items insertObject:hb atIndex:[self.button_items count]]; [hb addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside]; I am not finding a way to set the button type for this custom button. Is there a way i can do it ? Or is there a better way to design the code.

    Read the article

  • How to make UIButton work like Launcher in SpringBoard, when pressed for long timeinterval

    - by KayKay
    In my ViewController I am using UIButton which triggers some action when touchedUpInside. Upto here no problem, but i also want to add another action for touchDown event. More precisely i dont have an idea how to add that action to which event, that will work the same as when App-Icon is pressed longer in springboard which causes springboard enter in editing mode.Actually what i want is : when this button is kept holding for ,say about 2 seconds it will pop-up an alertView without touch being heldUp (with finger is still on button). I have tried with 2 NSdate difference, one of which is allocated when touchedDown and other when touchUpInside. Its working and popping alert,but only after touchedUpInside. I want it to show alert without touch being removed. Here is the code. (IBAction)touchedDown:(id)sender { momentTouchedDown = [[NSDate alloc] init];//class variable NSLog(@"touched down"); } - (IBAction)touchUpInside:(id)sender { NSLog(@"touch lifted Up\n"); NSDate *momentLifted = [[NSDate alloc] init]; double timeInterval = [momentLifted timeIntervalSinceDate:momentTouchedDown]; NSLog(@"time lifted = %@, time down = %@, time diff = %@", momentLifted, momentTouchedDown, [NSString stringWithFormat:@"%g",timeInterval]); [momentLifted release]; if(timeInterval > 2.0) { NSLog(@"AlertBox has been fired"); UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Yes" message:@""//msg delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK" , nil]; [alert show]; [alert release]; } } Please provide me an insight..thanks for help in advance.

    Read the article

  • A simple way to put a UIImage in a UIButton

    - by Alice
    I have a UIButton in my iPhone app. I set its size to 100x100. I have an image that is 400x200 that I wish to display in the button. The button STILL needs to stay at 100x100... and I want the image to downsize to fit... but keep the correct aspect ratio. I thought that's what "Aspect Fit" was used for. Do I include my image with setImage, or setBackgroundImage? Do I set AspectFit for the button? or the image? or the background image? (I need the smaller images to INCREASE in size. While larger images should DESCREASE in size. Always keeping the button at 100x100.) I've tried countless combinations of all of the above... and I just can't seem to get everything to work at the same time: Don't change the button's size of 100x100. Don't destroy the image's aspect ratio. Always increase small images to fit the button. Always decrease large images to fit the button. Never clip any of the image edges. Never require the "put UIButtons over all your UIimages" hack. Don't require everyone to upgrade to v4.2.1 just to use new framework methods. I see so many apps, with so many fully-working image-buttons... that I can't believe I can't figure out this very simple, very common thing. Ugh.

    Read the article

  • Interface builder UIButton custom background image not working on simulator/device

    - by xenonii
    I'm trying to do something really simple. I have an image for a button and I'm trying to set it on a custom button in interface builder. I set the background image accordingly (no case sensitivity problem here). In interface builder it shows up, but in the simulator or on the device it doesn't appear at all. Just the button's text will appear. Do I need to turn on some flag or something of the sort?

    Read the article

  • Access UIButton's titleLabel with custom background image

    - by Meltemi
    Quick one: I have a custom button image that I want to use but I still want to change the text of the button with setTitle:forState:. When I use a "custom" button in IB I lose the Title view. When I use Rounded Rect in IB the custom image appears scrunched w/in the Rounded Rect button. Why is this so difficult?

    Read the article

  • Rotating a UIButton with a custom image (animation)

    - by Tiago
    Hi, I'm trying to rotate a button that I've connected to the controller from the Interface Builder. I've set it's image right from Interface Builder. I'm using this code on the method that runs when I click it: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:2.0]; [UIView setAnimationRepeatCount:5]; updateButton.transform = CGAffineTransformMakeRotation( M_PI ); [UIView commitAnimations]; But this doesn't do anything. Can this be done, or should I create the button programmatically in order to get it to rotate?

    Read the article

  • uibutton onclick does not call/open web page

    - by raqz
    i have two buttons defined. one of them when clicked must open a compose mail screen and the other when clicked must call. i have this defined as below. but when the button is pressed, it does not open either -(IBAction) phoneButtonPressed:(id) sender{ NSString *phoneNumber = [[NSString alloc] initWithString:@"4216483330"]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:phoneNumber]]; } -(IBAction) mailButtonPressed:(id) sender{ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto:[email protected]?subject=ULS Library"]]; }

    Read the article

  • Touch area changing on custom UIButton with image and title on landscape mode

    - by gkedmi
    hello all I'm trying to build a button that looks like the icons on the iphone , with an image and a title bellow.I'm working in landscape mode. I have a custom button on the IB with image and title and inside the code I use the methods : [aButton setTitleEdgeInsets:UIEdgeInsetsMake(60.0, -50.0, 0.0, 0.0)]; [aButton setImageEdgeInsets:UIEdgeInsetsMake(-10.0, 29.0, 0.0, 0.0)]; my problem is that the area that react to the touch events is very small and is on the top left of the button , another problem is that if I change my button size I have to calculate again manually the values for these 2 functions. Is there any easy way to do it?and if not how can I fix the touch area? thanks Gilad

    Read the article

  • 'NSInvalidArgumentException' UIButton IBAction Error

    - by Graeme
    Hi, I have a button in a view which refuses to work. I've got in working in a blank, default view application from X-Code, but in none of my applications will it work, instead it gives me the following error. Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UIViewController showVicInfo:]: unrecognized selector sent to instance 0x3c084f0' The debugger isn't any help either. I've made sure that I hook up the button to the file's owner (not the other way around) as well. Below is the code for the action. And I know it's not the alert view, because the breakpoint doesn't even reach there. about.h @interface about : UIViewController { } -(IBAction)showInfo:(id)sender; about.m -(IBAction)showVicInfo:(id)sender { UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"No Internet Connection" message:@"You require an internet connection via WiFi or cellular network for iFirelert to work." delegate:self cancelButtonTitle:@"OK, thanks" otherButtonTitles:nil]; [myAlert show]; [myAlert release]; }

    Read the article

  • change UIbutton color inside UITableViewCell

    - by KK
    I have a simple problem ... but its turning into a very difficult problem .. i have a button inside uitableviewcell and want to change its color through code .... i could aceive it by changing its background image. But its kinna hazy ... its not the solid color ... and when i use [cell.button setBackgroundColor:[UIcolor redColor]] ... the button color does not change ... any help appreciated thanks

    Read the article

  • cover/image that will hide a UIButton, but still let it be touched

    - by Sam Jarman
    Any ideas on how to create a cover that has alpha 100 but is able to let a button behind it be touched, and an action to be called. i dont want to apply the action to the cover, nor change the buttons image - as a convaluted set up is required for each one. any ideas? what im after is effective not a see-through button, but a touch through button... Cheers in advance guys sam

    Read the article

  • IBAction UIButton and EXC_BAD_ACCESS

    - by mr.octobor
    in .h file I write -(IBAction)openShuffleForm; and .m -(IBAction)openShuffleForm{ NSLog(@"XXXXXXX"); } and connect with even touch up inside but when I run my program it error show this message -[UITouchData openShuffleForm]: unrecognized selector sent to instance 0x391cc20 ** what happen I don't know why !?

    Read the article

  • Passing values from UIButton to an UIActionSheet

    - by Michael
    I'm trying to send an ActionSheet a variable from a button. I can't use the tag property because its being used for something else. I've declared myIndexRow as an instance variable and have: NSInteger myIndexRow = indexPath.row; [deleteButton addTarget:self action:@selector(showDeleteSheet:) forControlEvents:UIControlEventTouchUpInside]; deleteButton.myIndexRow = myIndexRow; but I'm getting the 'Request for member 'myRow' is something not a structure or union' There is something obvious I am missing here.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >