Search Results

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

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

  • Change UIButton Background Image more than once per second

    - by beta.services
    I am currently working with the iPhone SDK. I have a NSTimer that changes the background image of a UIButton. Once this is complete, it will trigger the same action again (reset the NSTimer) for a predetermined number of times. My problem is that if my NSTimer is set to execute more than once per second. (0.75, say) The background image wont change. I am using NSLog to check that the event fires. But the button image will just remain in its original state. Is there any way to change the background image more often than once per second? This is my timer : [NSTimer scheduledTimerWithTimeInterval: tmpLvlSpeed target: self selector: @selector(simPressRed:) userInfo: nil repeats: NO]; And the code to change the image: [btnRed setImage:[UIImage imageNamed:@"btn_red.png"] forState:UIControlStateNormal]; if tmpLvlSpeed is less than 1.0, the button image will never change. Even though the simPressRed function will still fire. Any clues? Is there an update cycle I can modify?

    Read the article

  • iphone menu navigation with buttons help requested

    - by David
    Hi, I'm trying to program an iphone app that will have several different (sub)apps. Ideally, I want to know how to make the main menu for this app look and behave like the iphone's own app menu, but I can't figure it out. If any one knows a package or library that does this, please let me know. Plan B is to mock one using UIButtons, and here is where I'm having problems. Basically, when I press a button that should push a new view, it calls the push method, but I still see the top view. in the app delegate, I have something like: AppViewController *viewController; App1ViewController *app1ViewController; UINavigationController *navController; and in didFinishLaunching method, something like: viewController = [ [ AppViewController alloc ] initWithAppDelegate: self ]; app1ViewController = [ [App1ViewController alloc ] initWithAppDelegate: self ]; navController = [ [ UINavigationController alloc ] initWithRootViewController:viewController]; [window addSubview:viewController.view]; and 2 methods -(void)app1{[ navController pushViewController: app1ViewController animated:YES ];} -(void)back{[ navController popViewControllerAnimated:YES ];} then I have 2 viewcontrollers in AppViewController.h @interface AppViewController : UIViewController { UINavigationController *navController; UIButton *appbtn1, *appbtn2, *appbtn3, *appbtn4; } -(id)initWithAppDelegate:(id)appDelegate; @end @interface App1ViewController : UIViewController { UITextView *textView; UINavigationController *navController; } -(id)initWithAppDelegate:(id)appDelegate; @end and define a loadView for each viewcontroller. However, when I press the app1 button and the app1 method gets called, it says the view hasa been pushed, but my view remains the buttons view, i.e. the root view. If I press the button again, it tells me I can't repush the app1view, the one I can't see. Any ideas? I can post the full code if that helps. Thank you for your time.

    Read the article

  • iPhone - how to track touches and allow button taps at the same time?

    - by Jonathan Cohen
    I'm wondering how to track touches anywhere on the iPhone screen and still have UIButtons respond to taps. I subclassed a UIView, made it full screen and the highest view in the hierarchy, and overrode its pointInside:withEvent method. If I return YES, I'm able to track touches anywhere on the screen but the buttons don't respond (likely because the view is instructed to handle and terminate the touch). If I return NO, the touch passes through the view and the buttons respond, but I'm not able to track touches. Do I need to subclass UIButton or is this possible through the responder chain? What am I doing wrong? - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{ return NO; } //only works if pointInside:withEvent: returns YES. -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"began"); [self.nextResponder touchesBegan:touches withEvent:event]; } //only works if pointInside:withEvent: returns YES. -(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ NSLog(@"end"); [self.nextResponder touchesEnded:touches withEvent:event]; }

    Read the article

  • Custom back button click event on pushed view controller

    - by TechFusion
    Hello, I have pushed view controller and load WebView and Custom rectangular rounded button on right down left corner into view using programmatic way. -(void)loadView { CGRect frame = CGRectMake(0.0, 0.0, 480, 320); WebView = [[[UIWebView alloc] initWithFrame:frame] autorelease]; WebView.backgroundColor = [UIColor whiteColor]; WebView.scalesPageToFit = YES; WebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin); WebView.autoresizesSubviews = YES; WebView.exclusiveTouch = YES; WebView.clearsContextBeforeDrawing = YES; self.roundedButtonType = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain]; self.roundedButtonType.frame = CGRectMake(416.0, 270.0, 44, 19); [self.roundedButtonType setTitle:@"Back" forState:UIControlStateNormal]; self.roundedButtonType.backgroundColor = [UIColor grayColor]; [self.roundedButtonType addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside]; self.view = WebView; [self.view addSubview: self.roundedButtonType ]; [WebView release]; } This is action that I have added as back button of navigation. -(void)back:(id)sender{ [self.navigationController popViewControllerAnimated:YES]; } -(void)viewDidUnload{ self.WebView = nil; self.roundedButtonType = nil; } -(void)dealloc{ [roundedButtonType release]; [super dealloc]; } Here, When Back button click then it is showing previous view but application got stuck in that view and GDB shows Program received signal :EXC_BAD_ACCESS message. how resolve this issue? Thanks,

    Read the article

  • Moving UIButton around

    - by pbcoder
    I've tried to move a UIButton up and down in a menu. The problem I've got with the following solution is that the timer is not accurate. Sometimes the Button is moved up 122px, sometimes only 120px. How I can fix this? -(IBAction)marketTabClicked:(id)sender { if (marketTabExtended) { NSLog(@"marketTabExtended = YES"); return; } else { if (iPhoneAppsExtended) { timer = [NSTimer scheduledTimerWithTimeInterval:0.005 target: self selector: @selector(animateItemApps) userInfo: nil repeats: YES]; } else { if (homepageExtended) { timer = [NSTimer scheduledTimerWithTimeInterval:0.005 target: self selector: @selector(animateItemHomepage) userInfo: nil repeats: YES]; } else { timer = [NSTimer scheduledTimerWithTimeInterval:0.005 target: self selector: @selector(animateItemMarketing) userInfo: nil repeats: YES]; } } } [self performSelector:@selector(stopTimer) withObject:self afterDelay:0.605]; iPhoneAppsExtended = NO; homepageExtended = NO; marketTabExtended = NO; marketTabExtended = YES; } -(void)animateItemApps { CGPoint movement; movement = CGPointMake(0, -1); homepage.center = CGPointMake(homepage.center.x, homepage.center.y + movement.y); } -(void)animateItemHomepage { CGPoint movement; movement = CGPointMake(0, 1); homepage.center = CGPointMake(homepage.center.x, homepage.center.y + movement.y); //marketTab.center = CGPointMake(marketTab.center.x, marketTab.center.y + movement.y); } -(void)animateItemMarketing { CGPoint movement; movement = CGPointMake(0, -1); //marketTab.center = CGPointMake(marketTab.center.x, marketTab.center.y + movement.y); homepage.center = CGPointMake(homepage.center.x, homepage.center.y + movement.y); } -(void)stopTimer { [timer invalidate]; }

    Read the article

  • Two Problems I'm having with UIButton and UIView.

    - by Andy
    Hi all, I haven't been programming on the iPhone for very long, but I'm picking it up slowly by googling problems I get. Unfortunately I haven't been able to find an answer for these. I have started a new View-based application in Xcode 3.2.2 and immediately added the following files: myUIView.m and myUIView.h, which are subclasses of UIView. In Interface Builder, I set the subclass of the default UIView to be myUIView. I made a button in the drawRect method. Problem one: The title of the button only appears AFTER I click the screen, why? Problem two: I want the button to produce the modalview - is this possible? The code is as follow: #import "myUIView.h" @implementation myUIView - (void)drawRect:(CGRect)rect { // Drawing code button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(0,0,100,100); [button setTitle:@"butty" forState:UIControlStateNormal]; [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:button]; } -(void)buttonPressed:(id)sender{ NSLog(@"Button pressed"); //present modal view somehow..? } I can't see how to post attachments, but if anyone thinks it will help I can upload the source. Many thanks, Andy

    Read the article

  • UIButton stops responding after going into landscape mode - iPhone

    - by casey
    I've been trying different things the last few days and I've run out of ideas so I'm looking for help. The situation is that I'm displaying my in-app purchasing store view after the user clicks a button. Button pressed, view is displayed. The store shows fine. Inside this view, I have a few labels with descriptions of the product, and then below them I have the price and a Buy button which triggers the in-app purchase. Problem is when I rotate the phone to landscape, that Buy button no longer responds, weird. Works fine in portrait. The behavior in landscape when the I touch the button is nothing. It doesn't appear to press down and be selected or anything, just not responding to my touches. But then when I rotate back to portrait or even upside down portrait, it works fine. Here is the rough structure of my view in IB, all the rotating and layout is setup in IB. I set the autoresizing in IB so that everything looks ok in landscape and the Buy button expands horizontally a little bit. The only layout manipulation I do in my code is after loading, I set the content size of the scroll view. File Owner with view set to the scrollView / scrollView ----/ view --------/ label --------/ label --------/ label --------/ label --------/ label --------/ label --------/ label --------/ label --------/ uibutton (Buy) After orientation changes I printed out the userInteractionEnabled property of the scrollView and the button, and they were both TRUE at all orientations. Ideas? Or maybe some other way of displaying a buy button that won't be nonfunctional? I've already begun a branch that plays with a toolbar and placing the buy button there, but I can't seem to get the bar to stay in place while scrolling.

    Read the article

  • Having trouble hiding keyboard using invisible button which sits on top of uiscrollview

    - by phil
    I have 3 items in play... 1) UIView sits at the base of the hierarchy and contains the UIScrollview. 2) UIScrollview that is presenting a lengthy user form. 3) An invisible button on the UIScrollview that I'm using to provide "hide the keyboard" features. Notice in the code below that I'm registering to be notified when the keyboard is going to appear and again when it's going to disappear. These are working great. My problem is seemingly one of "layers". See below where I insert the button into the view atIndex:0. This causes the button to be activated and "stuffed" behind the scrollview so that when you click on it, the scrollview grabs the touch and the button is unaware. There is no way to "reach" the button and suppress the keyboard. However, if I insert atIndex:1, the button gets super imposed on top of the text entry fields and so any touch at all is acted upon by the button, which immediately suppresses the keyboard and then disappears. How do I insert the button on top of the UIScrollview but behind the UITextfields that sit there? other logistics: I have a -(void) hidekeyboard function that I have setup with the UIButtion as an IBAction(). And I have the UIButton connected to "files owner" via a ctrl-drag/drop. (Do I need both of those conventions?) This code in ViewDidLoad()... [[NSNotificationCenter defaultCenter] addObserverForName:UIKeyboardWillShowNotification object:nil queue:nil usingBlock:^(NSNotification *notification){ [self.view insertSubview:self.keyboardDismissalButton atIndex:0]; }];

    Read the article

  • iPhone app. Creating a custom UIView that contains UITextField and UIButton.

    - by Dmitry Burchik
    Hi all. I am new to iPhone programming. And I have an issue. I need to create a custom user control that I will add to my UIScrollView dinamically. The control has an UITextField and an UIButton. See the code below: #import <UIKit/UIKit.h> @interface FieldWithValueControl : UIView { UITextField *txtTagName; UIButton *addButton; } @property (nonatomic, readonly) UITextField *txtTagName; @property (nonatomic, readonly) UIButton *addButton; @end #import "FieldWithValueControl.h" #define ITEM_SPACING 10 #define ITEM_HEIGHT 20 #define SWITCHBOX_WIDTH 100 #define SCREEN_WIDTH 320 #define ITEM_FONT_SIZE 14 #define TEXTBOX_WIDTH 150 @implementation FieldWithValueControl @synthesize txtTagName; @synthesize addButton; - (id)initWithFrame:(CGRect)frame { if (self = [super initWithFrame:frame]) { // Initialization code txtTagName = [[UITextField alloc] initWithFrame:CGRectMake(0, 0, TEXTBOX_WIDTH, ITEM_HEIGHT)]; txtTagName.borderStyle = UITextBorderStyleRoundedRect; addButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; [addButton setFrame:CGRectMake(ITEM_SPACING + TEXTBOX_WIDTH, 0, ITEM_HEIGHT, ITEM_HEIGHT)]; [addButton addTarget:self action:@selector(addButtonTouched:) forControlEvents:UIControlEventTouchUpInside]; [self addSubview:txtTagName]; [self addSubview:addButton]; } return self; } - (void)addButtonTouched:sender { UIButton *button = (UIButton*)sender; NSString *title = [button titleLabel].text; } - (void)drawRect:(CGRect)rect { // Drawing code } - (void)dealloc { [txtTagName release]; [addButton release]; [super dealloc]; } @end In my code I create an object of that class and add it to scrollView on form. FieldWithValueControl *newTagControl = (FieldWithValueControl*)[[FieldWithValueControl alloc] initWithFrame:CGRectMake(ITEM_SPACING, currentOffset + ITEM_SPACING, 0, 0)]; [scrollView addSubview:newTagControl]; The control looks fine, but if I click to the textbox or to the button nothing happens. Keyboard doesn't appear, the button is not clickable etc.

    Read the article

  • How do I hide the UITableViewCell border for a custom cell in a group tableview?

    - by Gorgando
    What I am trying to do: I want three buttons side-by-side in a tableviewcell just like in Contacts app. What I've done: I have a custom tableviewcell with three uibuttons in it. I've set the background color of the tableviewcell to be transparent. What I can't figure out: The tableviewcell border is still there! Everything looks great except for the border floating around the 3 buttons. Am I doing this completely wrong? Or is there a simple way to remove/hide the border? Thanks!!!

    Read the article

  • Adding a modal view controller when I press a info button inside a tableviewCell

    - by gvalero87
    Hi, Here is a complex question, maybe it's not hard but there are many doubts i have. First let me give you what i have. This is the only place where i've gotten good answers. I have a table view controller with custom cells. In those cells i added a button (info dark one from IB) for each one of the cells. What i would like it's that when I press that button it displays a new view with more information about that cell, different of the view that i get from didSelectRowAtIndexPath. I've read a little bit about Modal View Controller and I think this is a case where I should use it. So here are my questions: How do i make a view controller a modal view controller?. I read that i have to have a delegate. Is there an example of how to create a normal modal view controller. I haven't been able to do so. How can this button know which cell is it from?. What i have right is a subclass tableviewcell with an IBOUTLET to this info button. This is not an important question because i guess i just could add a NSIndexPath attribute. I added an action in my tableviewsubclass that is triggered when the touchDown Event is called. I did this connection through IB. How can I call the modal view controller through here?, and is it even the right place to do this? Thanks

    Read the article

  • jquery buttonset()

    - by Kevin
    Hi - I'm using the jquery buttonset() on a set of radio buttons (to tart them up). I'd like to be able to set the selected radio button on another user event. I've been looking into this and while I can set the selected radio button, but I cannot also (easily) update the UI to indicate what the selected radio button is. From what I can tell, I need to call this to set the radio button at index n to be checked $('input[name="transactionsRadio"]')[n].checked = true; And then do some convoluted jquery selector calls to remove the ui-state-active from one lable and apply it to the new label. Is this really the most optimal way to do this ? I had expected an equivalent method to the 'activate' method that is available for the jquery Accordian control. Any more elegant solution would be appreciated! Thanks, Kevin.

    Read the article

  • Custom UIBarButtonItem with quartz

    - by burki
    Hi! How can I draw a button with quartz that has exactly the same style as a UIBarButtonItem. The button should be able to show different colors. I downloaded the Three20 project, but this project is really complex, you'd need a lot of time to overlook the whole framework. I just want to draw a custom UIBarButtonItem. Thanks for help.

    Read the article

  • cocoa - making a UIImageView class act like a UIButton

    - by Mike
    For some reason that will take too much time to explain, I have to create a UIImageView based class that has some properties of a button. Imagine a class like the UISwitch (no I cannot base my class on the UISwitch) with two states, on and off. WHen the user selects one state, it runs a method like a button that was clicked and the method receives the sender id. I have already the class more or less working. The class is based on UIImageView. I am having difficulties to understand the following. WHen I create a new button I have a line that is like [myButton addTarget:self action:NSSelectorFromString(myMethod) forControlEvents:UIControlEventTouchUpInside]; This line defines a target and an action to run when the button is triggered. I my case I would need something like [myObject addTarget:self action:myMethod ifState:1] //or another thing ifState:2 I have no idea what kind of code I should put on the class to make this work. Remember that as a button the class should send the "sender" information to identify the object which triggered the action... Can you guys, transcendental gurus help? thanks for any help!

    Read the article

  • uitextview and sqlite3

    - by summer
    Hi guys, i would like to know whether is it possible to save the edited text in UITextView to sqlite3 by using a button?if so is there anywhere i can find the easiest way to do it?been googling but in vain..

    Read the article

  • UINavigationBar is getting buttons from another view

    - by Rafael Oliveira
    I have three Views, Splash, Login and List. From Splash I just wait and then Push Login View, with the Navigation Bar hidden. In Login I Show the NavigationBar, hide the BackButton1 and add a new RightButton1, then I check if Settings.bundle "login" and "pass" are set. If so, I push List View. Otherwise I stay in the Login view waiting for the user to fill the form and press a button. In List View I add a new RightButton2 and a new BackButton2. The problem is that if Settings.bundle data is not null, and in Login View I quickly push List View the RightButton1 appears in List View, or no buttons appear at all, or only BackButton2 doesn't appear... The most strange thing of all is that everything was OK and all of sudden it started to get messy. Login View: // Making the Navigation Bar Visible [self.navigationController setNavigationBarHidden:NO animated:NO]; // Hiding the Back Button in THIS view (Login) [self.navigationItem setHidesBackButton:YES]; // Inserting the Logout Button for the Next View (List) UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStylePlain target:nil action:nil]; self.navigationItem.backBarButtonItem = backButton; [backButton release]; UIBarButtonItem* newAccountButton = [[UIBarButtonItem alloc] initWithTitle:@"New Account" style:UIBarButtonItemStylePlain target:self action:@selector(newAccountButtonPressed)]; self.navigationItem.rightBarButtonItem = newAccountButton; [newAccountButton release]; List View // Making the Navigation Bar Visible [self.navigationController setNavigationBarHidden:NO animated:NO]; UIBarButtonItem* aboutButton = [[UIBarButtonItem alloc] initWithTitle:@"About" style:UIBarButtonItemStylePlain target:self action:@selector(aboutButtonPressed)]; self.navigationItem.rightBarButtonItem = aboutButton; [aboutButton release]; Any ideas ?

    Read the article

  • Make an iPhone InfoButton light/dark based on color behind it

    - by Paula
    How do I detect what color is under the InfoButton... so I can change the button from DARK to LIGHT? I set my view's color... but how do I tell if it's "kind of light" or "kind of dark"? Besides... I can't change the info-button from light to dark anyway. (read only) Ugh. Shouldn't Apple have some kind of a simple "cmdButton.doThisExtremelyCommonThingForMe = TRUE" statement? InfoButtons are useless if you can't even see them. (Or how would I put an image behind the button to make it stand-out more?)

    Read the article

  • All my UIButtons and UITableRowViews are now gray

    - by Greg Maletic
    Not sure how this happened, but all of the UITableRowViews and roundrect-style UIButtons in my app—spanning a dozen or so views—are now all gray instead of white. Unfortunately, I have no idea how this happened. (In fact, I had no idea it was possible to do this.) Explicitly setting the button's or tableRowView's background color to white gets it back to normal. But it'll be a lot of work to do that to every one of my views...and I'd rather not have to do it since there's obviously something simple that caused it in the first place. How did I break this? Thanks very much.

    Read the article

  • cocoa - making a class like UIButton

    - by Mike
    For some reason that will take too much time to explain, I have to create a UIImageView based class that has some properties of a button. Imagine a class like the UISwitch (no I cannot base my class on the UISwitch) with two states, on and off. WHen the user selects one state, it runs a method like a button that was clicked and the method receives the sender id. I have already the class more or less working. The class is based on UIImageView. I am having difficulties to understand the following. WHen I create a new button I have a line that is like [myButton addTarget:self action:NSSelectorFromString(myMethod) forControlEvents:UIControlEventTouchUpInside]; This line defines a target and an action to run when the button is triggered. I my case I would need something like [myObject addTarget:self action:myMethod ifState:1] //or another thing ifState:2 I have no idea what kind of code I should put on the class to make this work. Remember that as a button the class should send the "sender" information to identify the object which triggered the action... Can you guys, transcendental gurus help? thanks.

    Read the article

  • Replicate UISegmentedControl with UIButtons - iPhone

    - by Sam
    Hi guys, I didnt like the style of UISegmentedControl, hence i tried to change the way it looked, but I couldnt attach images to its buttons. I just didnt change at all. Now i'm looking at how to replicate that function with 4 UIButtons. I've setup 4 UIButtons in interface builder, added different tag numbers to them. What i cannot accomplish is when a button is tapped, it should be "selected" and the other buttons should be Unselected. How can i connect all of them? And if there was a way to change the UISegmented control looks, i would need all this effort. thanks for the help guys this is for iPhone OS

    Read the article

  • UIButtons work when rotated right, but not when rotated left. Huh?

    - by Ben Collins
    I have a view that is added to the current view when the device is rotated to a LandscapeLeft or LandscapeRight orientation. This view has 4 buttons on it that are all connected to outlets and each have the "touch up inside" event hooked up to the same action. If rotated to a LandscapeLeft orientation, I transform my added view to rotate -90 degrees, and everything works fine. If rotated to a LandscapeRight orientation, I transform the added view to rotate 90 degrees, and the buttons don't work! Highlighting doesn't happen, and the action isn't called. I am at a bit of a loss as to why this might be. Any ideas?

    Read the article

  • Align UItextFields one below the other in interface builder

    - by Dave
    How to align 2 textfields one below the other in a tool bar and display a button on the left side (or right side) in the vertical middle of those two fields? Please see the image to know what I am talking about. http://developer.apple.com/iphone/library/documentation/userexperience/conceptual/mobilehig/art/ui_textfields.jpg

    Read the article

  • IPhone UIView:Is it possible to enable userinteraction only on subviews?

    - by Syg
    Hi guys, I created a viewcontroller that displays a button which is used to slide a view onto the screen. The idea is to place for instance three such viewcontrollers onscreen, resulting in three buttons at the bottom of the screen providing navigation. The viewcontrollers get stacked, so to the top one is now overlaying the other views and therefore the other buttons. Only the top viewcontroller's button is working in this situation, where I would like all three of them to be clickable. I tried disabling userinteraction on the view and enabling it on the buttons only, but it looks like the superview settings overrule the subview settings. Any ideas?

    Read the article

  • Objective C IBOutlets

    - by Alan
    In cases where multiple buttons call an IBOutlet, can the IBOutlet determine which button was pressed? edit: All fixed and wired up. key point: Object ID is not sender tag! Tag is a standalone value on the first page of the attributes. - (IBAction)buttonPressed:(id)sender { switch ( [sender tag] ) { case 109: NSLog(@"Button 1"); break; case 108: NSLog(@"Button 2"); break; } }

    Read the article

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