Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
BUILD A SIMPLE IPHONE APP, MAKING IT PRETTY = EXTRA CREDIT
Can someone kindly tell me how to complete the following task:
"Delete the button from the Storyboard and try to add it programmatically within the viewDidLoad method.
Set an image for the button using its background image property and then set the title text. This should allow you to change the text of your button without having to change the image."
When I attempted it by button when to the top and when I pressed the button nothing happened.
Hi im having a similar problem to this..
I have tried searching and have so far got this:
UIImage *button = [UIImage imageNamed:@"PredictButton.png"]; UIImage *buttonOff = [UIImage imageNamed:@"PredictButtonOff.png"]; UIImageView *buttonView = [[UIImageView alloc] initWithImage:button highlightedImage:buttonOff]; buttonView.userInteractionEnabled = YES; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(imageTapped)]; [buttonView addGestureRecognizer:tap]; buttonView.frame = CGRectMake(20, 380, 280, 40); [self.view insertSubview:(buttonView) atIndex:0];
(*Also need to find out how it will link to change the predictionArray and change the predictionLabel.text)
Im stuck where to go next as trying to link the touchGesture so it enables the highlighted version?
To be honest i think ive made things a little too complicated already...
Eduardo Rojas4,084 Points
What am i doing wrong?
UIButton *btnDemo = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btnDemo.frame = CGRectMake(100, 100, 100, 100); [btnDemo setTitle:@"Show Alert" forState:UIControlStateNormal];
[btnDemo addTarget:self action:@selector(touchUpHandler:) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:btnDemo];
My Error Says Undeclered Selector touchUpHandler