Search Results

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

Page 10/18 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • how can i set the background color of a particular button in iphone ?

    - by suchita
    for this I used btnName1 = [ColorfulButton buttonWithType:UIButtonTypeRoundedRect]; btnName1.frame=CGRectMake(45,146,220,40); [btnName1 setTitle:@"Continue" forState:UIControlStateNormal]; [btnName1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; [btnName1 setImage:[UIImage imageNamed:@"green.png"] forState:UIControlStateNormal]; UIImage *img =[UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"greenish" ofType:@"png"]]; UIImage *strechableImage = [img stretchableImageWithLeftCapWidth:12 topCapHeight:0]; [btnName1 setBackgroundImage:strechableImage forState:UIControlStateNormal]; [btnName1 setNeedsDisplay]; [InfoView addSubview:btnName1]; it's correctly working on iphone simulator but not on ipod(color not show in ipod)

    Read the article

  • UITableView not showing background image.

    - by K.Honda
    I have a uitableview with 2 cells (custom tableviewcells) and a button for login. I made them programmatically. Now I want to put a background image behind the 2 custom cells and the button. I went into IB and put the image view on top of the tableview and then put a picture on it which I want as the background. Then I went into viewDidLoad and put this bit of code tblSimpleTable.backgroundColor = [UIColor clearColor]; to clear the tableviews background colour. It now looks like this: But the background does not appear. Does anyone know how to fix this? Thanks.

    Read the article

  • How to place a Rounded Rect UIBUTTON on UITableViewCell programmatically

    - by Tobias
    I was trying to place two uibuttons on uitableviewcell programmatically.. but unable to achieve that. somehow i managed to get the buttons through some sample project in which u can draw a nib for cell.. but i was unable to set a selector function for buttons.. in other example i can place a uiinfodark type button but when i change the type to rounded rect the button gets disappeared and i am unable to figure out why? I might be doing some silly mistake but I am really kinda stuck with it right now so I'll be very much thankful to all of you for helping in this regard.

    Read the article

  • Which icons/buttons to use for help, about, info?

    - by 4thSpace
    I use the info button to display a settings page. This page is a modal. I need another button from here to display "About" info, since I've already used "info" for something. I have a search form that is accessed only from the modal. On the search form, I need a help icon. I can use the info button but that seems confusing, since I already use the info button from the main view to access the modal. What else can I do for help and about icons/buttons?

    Read the article

  • Checking if a touch is withing a UIButton's bounds.

    - by Joshua
    I am trying to make an if statement which will check whether the users touch is within a UIButton's bounds. I thought this would be an easy affair as UIButton is a subclass of UIView, however my code doesn't seem to work. This is the code I have been using. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *array = [touches allObjects]; UITouch *specificTouch = [array objectAtIndex:0]; currentTouch = [specificTouch locationInView:self.view]; if (CGRectContainsPoint(but.bounds, currentTouch)) { //Do something is in bounds. } //Else do nothing. }

    Read the article

  • Checking if a touch is within a UIButton's bounds.

    - by Joshua
    I am trying to make an if statement which will check whether the users touch is within a UIButton's bounds. I thought this would be an easy affair as UIButton is a subclass of UIView, however my code doesn't seem to work. This is the code I have been using. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { NSArray *array = [touches allObjects]; UITouch *specificTouch = [array objectAtIndex:0]; currentTouch = [specificTouch locationInView:self.view]; if (CGRectContainsPoint(but.bounds, currentTouch)) { //Do something is in bounds. } //Else do nothing. }

    Read the article

  • Any point in subclassing UIButton to create a custom looking button?

    - by glitch
    I want to create a set of buttons that would work and feel very much like the Metro-style tiles that are available on Windows Phones. I would like to allow the user to tap them to access their underlying functionality (open a modal or something or that sort). I'm concerned that subclassing UIButton will not get me there. I need square corners and dynamic content inside the tiles themselves. The posts I've found around SO seem to suggest that subclassing a UIButton would not be a good idea for several reasons and that I should instead use UIView. That reply is from 2010, and I have no idea if in the 2+ years since then there have been considerable changes to how one would achieve that effect. Most users these days will have iOS 5.1+ if not 6.0 soon. Let's say I do go the UIView route. Should I implement UIResponder's touch events or should I instead go the UITapGestureRecognizer route? What's the better practice in 2012? Thank you!

    Read the article

  • how to pass a string value from one controller to another

    - by shreedevi
    I have a login controller ,and after the successful login i want to pass some string value to the menu page.however it does not work.the application crashes. I have tried possible suggesstion of Ihuk and SAM from the link below http://stackoverflow.com/questions/1685964/how-to-pass-a-string-value-from-one-view-controller-to-another-view-controller loginController.h: #import <UIKit/UIKit.h> @class RootViewController; @class Menu; @interface LoginController : UIViewController { UIButton *login_Button; UITextField *username_TextField; UITextField *password_TextField; RootViewController *mc1; UINavigationController *navigationController; Menu *mv1; } @property(nonatomic,retain) IBOutlet UIButton *login_Button; @property(nonatomic,retain) IBOutlet UITextField *username_TextField; @property(nonatomic,retain) IBOutlet UITextField *password_TextField; @property(nonatomic,retain) RootViewController *mc1; @property (nonatomic, retain) IBOutlet UINavigationController *navigationController; @property(nonatomic,retain)Menu *mv1; - (IBAction)Login_Method:(id)sender; -(id)initWithUserName:(NSString *)name ; @end loginController.m #import "LoginController.h" #import "Menu.h" #import "ViewController.h" #import "RootViewController.h" @implementation LoginController @synthesize mc1,mv1; @synthesize login_Button,username_TextField,password_TextField; @synthesize navigationController; // Implement viewDidLoad to do additional setup after // loading the view, typically from a nib. - (void)viewDidLoad { if (![self.navigationController isNavigationBarHidden]) [self.navigationController setNavigationBarHidden:YES animated:NO]; //[self presentModalViewController:navigationController animated:YES]; } - (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } - (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } - (IBAction)Login_Method:(id)sender { Menu *mv2 = [[Menu alloc] initWithUserName:@"Menu" bundle:nil]; //mv2.l1.text=@"aa"; //i tried this, but not work,so created initWithUserName self.mv1=mv2; [self presentModalViewController:mv1 animated:YES]; // [RootViewController release]; } -(id)initWithUserName:(NSString *)name { self = [super init]; if (nil == self) { return nil; } // display or store login info somewhere [mv1.l1 setText:name]; return self; } -(BOOL)textFieldShouldReturn:(UITextField *)theTextField { [theTextField resignFirstResponder]; return YES; } - (void)dealloc { [username_TextField release]; [password_TextField release]; [super dealloc]; } @end Menu.h #import <UIKit/UIKit.h> @class Menu; @interface Menu : UIViewController { UILabel *l1; UIButton *AccountSummary_Button; UIButton *PayOffQuote_Button; UIButton *PayBill_Button; UIButton *Logout_Button; UINavigationController *nv1; } @property(nonatomic,retain) IBOutlet UILabel *l1; @property(nonatomic,retain) IBOutlet UIButton *AccountSummary_Button; @property(nonatomic,retain) IBOutlet UIButton *PayOffQuote_Button; @property(nonatomic,retain) IBOutlet UIButton *PayBill_Button; @property(nonatomic,retain) IBOutlet UIButton *Logout_Button; @property (nonatomic, retain) IBOutlet UINavigationController *nv1; -(IBAction)ViewAccountSummary_method:(id)sender; -(IBAction)ViewPayOffQuote_method:(id)sender; -(IBAction)ViewPayBill_method:(id)sender; -(IBAction)Logout_method:(id)sender; @end Menu.m

    Read the article

  • Control ( UIButton, UILable) Hides when the Video plays Again on iPhone!

    - by Taimur Hamza
    Hi, I have displayed UIButton on top of Playing Movie using this code. NSArray *windows = [[UIApplication sharedApplication] windows]; if ([windows count] 1) { // Locate the movie player window UIWindow *moviePlayerWindow = [[UIApplication sharedApplication] keyWindow]; // Add our overlay view to the movie player's subviews so it is // displayed above it. [moviePlayerWindow addSubview:self.myABC]; } There are 2 buttons on top of my movie layer. They play different videos.Now the strange part is the video plays fine with buttons showing on top of it. When i press the button to play the other movie plays but the buttons doesnt show. Seems the view reloads and flushes all the Subviews. But i have checked it in the debug mode and it enters into the 'if' condition and this line runs [moviePlayerWindow addSubview:self.myABC]; But the buttons are not dislpayed. Any ideas wats going wrong ? Thanks, Taimur

    Read the article

  • A question is related to state maintainance

    - by user217572
    my question is like that My 5 th view is Acontroller and it has 1 UIButton.when i click on this UIButton my Bcontroller's view opens.this operation wrks perfectly. but i'm actually doing state maintainanace.when i reach to 5 th view of Acontroller.after that i press home button and then when i again click on application as per my state maintainance code 5 th view of Acontroller opens .but when i click on it's UIButton Bcontroller's view not open.why A code of UIButton is as below [self.navigationController pushViewController:bcontroller animated:YES]; bcontroller is nothing but object of Bcontroller

    Read the article

  • iPhone - UIView Animation on UIButton - button unclickable for portion of duration.

    - by Robert
    I am trying to have a button move around the screen and still be clickable. I have it moving around the screen correctly, but the odd thing is that I can't click the button until the final second of the animation. The button is still moving and yet after a certain threshold I can click it. Any idea what is happening? Any idea for some other way I can do what I want? Thanks for any help.

    Read the article

  • How to call a method on UIButton in NSArray?

    - by user1792818
    I'm trying to enable a button but the button that I would enable in this function changes. I have an array of the buttons but when I use the .enabled on the array index I want it says that this doesn't work for IDs. I have used this array to set the text of each button before using: [[ButtonArray objectAtIndex: Index] setTitle:(@"blahblahblah") forState: UIControlStateNormal]; is there any way to use a similar function call to enable and disable?

    Read the article

  • UIButtonTypeRoundedRect as an accessoryView

    - by phunehehe
    Hello, I have a table view and I want to put a label on the right of each cell, so in - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath I'm having some code like this UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.titleLabel.text = @"title"; cell.accessoryView = button; However, the button is not displaying at all. Anyone know why? I am sure that the declaration is correct, because if I replace the button declaration with UIButton *button = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; then the button appears, which make me think that the rounded rectangle should also appear.

    Read the article

  • How to overwrite a convenience constructor the proper way?

    - by mystify
    For example I want to overwrite from UIButton: + (id)buttonWithType:(UIButtonType)buttonType So I would do: + (id)buttonWithType:(UIButtonType)buttonType { UIButton *button = [UIButton buttonWithType:buttonType]; if (button != nil) { // do own config stuff ... } return button; } is that the right way? Or did I miss something? (yeah, I have been overwriting thousands of instance methods, but never class methods ;) )

    Read the article

  • How i pass my view to nib at run time(Dynamically) in viewController class?

    - by Rajendra Bhole
    Hi, I want to create viewController class programmatically in which the view of nib file of viewController is not fixed. I have a UntitledViewController class that contains 4 UIButtons: -(IBAction)buttonPressed:(id)sender{ if((UIButton *)sender == button1){ tagNumber = button1.tag; NewViewController *newVC = [[NewViewController alloc] init]; //newVC.tagN [self.navigationController pushViewController:newVC animated:YES]; NSLog(@"Button Tag Number:- %i", tagNumber); } if((UIButton *) sender == button2){ tagNumber = button2.tag; NewViewController *newVC = [[NewViewController alloc] init]; [self.navigationController pushViewController:newVC animated:YES]; } if((UIButton *) sender == button3){ tagNumber = button3.tag; NewViewController *newVC = [[NewViewController alloc] init]; [self.navigationController pushViewController:newVC animated:YES]; } if((UIButton *) sender == button4){ int x = tagNumber; tagNumber = button4.tag; NewViewController *newVC = [[NewViewController alloc] init]; newVC.untitledVC = self; [self.navigationController pushViewController:newVC animated:YES]; } } When I will click any one of the UIButtons, I want to create a new NewViewController class with button tag property but without fixed nib file. In NewViewController's loadView event I want to fix the view of the nib of NewViewController class using UIButton's tag property (In NewViewController.xib I'm creating 4 UIViews named view1, view2, view3 and view4). -(void)loadView{ [super loadView]; CGRect frame = CGRectMake(0, 0, 320, 480); UIView *newView = [[UIView alloc] initWithFrame:frame]; newView.tag = untitledVC.tagNumber; self.view1 = newView; } Now I want that when I click button1 the NewViewController will be generated with view1 and when I click button2 the NewViewController will be generated with view2 and so on with different implementation. Thanks.

    Read the article

  • UIButtons display differently on UIImageView when created at design time vs. run time

    - by PRITISH
    I have added some UIButton objects into .xib file, and some UIButton objects with the code. But now I am facing one problem. While Zooming the UIImageView the UIButtons that are added through code are shown on the UIImageView and those that are added with .xib file are below the UIImageView. Code for UIButtons added with code: btnBrightness = UIButton.FromType (UIButtonType.RoundedRect); btnBrightness.Frame = new RectangleF (540, 20, 95, 37); btnBrightness.SetTitle ("Brightness", UIControlState.Normal); More details: monotouch

    Read the article

  • NSInvalidArgumentException accessing NSMutableArray in a UITableView

    - by kashar28
    Hello, I am a noob in iPhone programming so kindly guide me. I have 5 buttons in a custom UITableViewCell. Following is the code to determine which button was pressed. In ProductTableCustomCell.m -(IBAction) getRating:(id) sender { ProductTableView *ptv = (ProductTableView *)self.superview; if((UIButton *) sender == box1) { [ptv.totalComments addObject:@"BOX2"]; } else if((UIButton *) sender == box2){ NSLog(@"Box2"); [ptv.totalComments addObject:@"BOX2"]; NSLog(@"Am I here?"); }else if((UIButton *) sender == box3){ NSLog(@"Box3"); [ptv.totalComments addObject:@"BOX3"]; }else if((UIButton *) sender == box4){ NSLog(@"Box4"); [ptv.totalComments addObject:@"BOX4"]; }else if((UIButton *) sender == box5){ NSLog(@"Box5"); [ptv.totalComments addObject:@"BOX5"]; } } Here totalComments is a NSMutableArray in ProductTableView which is a UITableView. If for example I click button2, then I get the following error: * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '* -[UITableView totalComments]: unrecognized selector sent to instance 0x4036e00'** I don't understand the problem. I have double checked the IBOutlets and IBActions as well. Everything seems proper. I think the problem is in the superview.Any help would be appreciated.

    Read the article

  • Add a multiple buttons to a view programatically, call the same method, determine which button it wa

    - by just_another_coder
    I want to programatically add multiple UIButtons to a view - the number of buttons is unknown at compile time. I can make one or more UIButton's like so (in a loop, but shorted for simplicity): UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchDown]; [button setTitle:@"Button x" forState:UIControlStateNormal]; button.frame = CGRectMake(100.0, 100.0, 120.0, 50.0); [view addSubview:button]; Copied/Edited from this link: http://stackoverflow.com/questions/1378765/how-do-i-create-a-basic-uibutton-programmatically But how do I determine in buttonClicked: which button was clicked? I'd like to pass tag data if possible to identify the button.

    Read the article

  • Problem with parsing strings

    - by Peter Small
    I am trying to put a line of dialog on each of a series of images. To match the dialog line with the correct image, I end each line with a forward slash (/) followed by a number to identify the matching image. I then parse each line to get the dialog and then the reference number for the image. It all works fine except that when I put the dialog line into a textView I get the whole line in the textView instead of the dialog part. What is confusing is that the console seems to indicate that the parsing of the dialog line has been carried out correctly. Here are the details of my coding: @interface DialogSequence_1ViewController : UIViewController { IBOutlet UIImageView *theImage; IBOutlet UITextView *fullDialog; IBOutlet UITextView *selectedDialog; IBOutlet UIButton *test_1; IBOutlet UIButton *test_2; IBOutlet UIButton *test_3; NSArray *arrayLines; IBOutlet UISlider *readingSpeed; NSArray *cartoonViews; NSMutableString *dialog; NSMutableArray *dialogLineSections; int lNum; } @property (retain,nonatomic) UITextView *fullDialog; @property (retain,nonatomic) UITextView *selectedDialog; @property (retain,nonatomic) UIButton *test_1; @property (retain,nonatomic) UIButton *test_2; @property (retain,nonatomic) UIButton *test_3; @property (retain,nonatomic) NSArray *arrayLines; @property (retain,nonatomic) NSMutableString *dialog; @property (retain,nonatomic) NSMutableArray *dialogLineSections; @property (retain,nonatomic) UIImageView *theImage; @property (retain,nonatomic) UISlider *readingSpeed; -(IBAction)start:(id)sender; -(IBAction)counter:(id)sender; -(IBAction)runNextLine:(id)sender; @end @implementation DialogSequence_1ViewController @synthesize fullDialog; @synthesize selectedDialog; @synthesize test_1; @synthesize test_2; @synthesize test_3; @synthesize arrayLines; @synthesize dialog; @synthesize theImage; @synthesize readingSpeed; @synthesize dialogLineSections; -(IBAction)runNextLine:(id)sender{ //Get dialog line to display from the arrayLines array NSMutableString *dialogLineDetails; dialogLineDetails =[arrayLines objectAtIndex:lNum]; NSLog(@"dialogLineDetails = %@",dialogLineDetails); //Parse the dialog line dialogLineSections = [dialogLineDetails componentsSeparatedByString: @"/"]; selectedDialog.text =[dialogLineSections objectAtIndex: 0]; NSLog(@"Dialog part of line = %@",[dialogLineSections objectAtIndex: 0]); NSMutableString *imageBit; imageBit = [dialogLineSections objectAtIndex: 1]; NSLog(@"Image code = %@",imageBit); //Select right image int im = [imageBit intValue]; NSLog(@"imageChoiceInteger = %i",im); //------more code } I get a warning on the line: dialogLineSections = [dialogLineDetails componentsSeparatedByString: @"/"]; warning: incompatible Objective-C types assigning 'struct NSArray *', expected 'struct NSMutableArray *' I don't quite understand this and have tried to change the types but to no avail. Would be grateful for some advice here.

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >