UIControl issue I think. Please help!

Joined
Mar 10, 2011
Messages
6
Reaction score
0
Points
1
Location
Valparaiso, IN
Your Mac's Specs
2009 Macook Pro
I'm new to iOS development, and have been following the tutorials on youtube from "thenewboston." I was working with his video:

YouTube - thenewboston's Channel

I got everything done in the tutorial, but when it came time to test the code, I had a problem. The build went fine. In the tutorial, he was demonstrating how to get the done button to do something and how to make the number-pad disappear when you tap the background. The done button worked, but not the tap background. The number-pad still stays up! I have reviewed everything I can think of in the code and in the Interface Builder. Does anyone have any suggestions? I'm using Xcode 4.0.1, btw.
 
Joined
Apr 2, 2011
Messages
18
Reaction score
0
Points
1
Location
Tennessee
Your Mac's Specs
2011 15" Macbook pro 2.2Gh Quad Core 8GB RAM and 2009 27" iMac 2.93Ghz ( Custom Mod ) Quad core and
Your going to need to add [whateverTextField resignFirstReponder];
to your void function that you put to dectect user touched the backgound . Should i post the code?
 
OP
B
Joined
Mar 10, 2011
Messages
6
Reaction score
0
Points
1
Location
Valparaiso, IN
Your Mac's Specs
2009 Macook Pro
Here is what I have in my "Bank_AccountViewController.m":


#import "Bank_AccountViewController.h"

@implementation Bank_AccountViewController
@synthesize name;
@synthesize password;
-(IBAction) goAwayKeyboard: (id) sender{
[sender resignFirstResponder];
}
-(IBAction) tapBackground: (id) sender{
[name resignFirstResponder];
[password resignFirstResponder];
}

- (void)dealloc
{
[super dealloc];
[name release];
[password release];
}

- (void)didReceiveMemoryWarning
{

[super didReceiveMemoryWarning];


}

#pragma mark - View lifecycle



- (void)viewDidUnload
{
[super viewDidUnload];

}

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{

return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
 
OP
B
Joined
Mar 10, 2011
Messages
6
Reaction score
0
Points
1
Location
Valparaiso, IN
Your Mac's Specs
2009 Macook Pro
Here is what I have in my "Bank_AccountViewController.h":


#import <UIKit/UIKit.h>

@interface Bank_AccountViewController : UIViewController {
UITextField *name;
UITextField *password;

}
@property(retain, nonatomic) IBOutlet UITextField *name;
@property(retain, nonatomic) IBOutlet UITextField *password;
-(IBAction) goAwayKeyboard: (id) sender;
-(IBAction) tapBackground: (id) sender;
@end
 
OP
B
Joined
Mar 10, 2011
Messages
6
Reaction score
0
Points
1
Location
Valparaiso, IN
Your Mac's Specs
2009 Macook Pro
Does anyone have any ideas on what is wrong based on the video and the code I posted?
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
Have you set the background view to be a UIControl and linked it to your tapBackground IBAction?
 
OP
B
Joined
Mar 10, 2011
Messages
6
Reaction score
0
Points
1
Location
Valparaiso, IN
Your Mac's Specs
2009 Macook Pro
I have linked the "touch up inside" control to the "tap background" listed in my code above. I followed the video tutorial exactly as he showed. It still doesn't work.
 
Joined
Feb 25, 2009
Messages
2,112
Reaction score
71
Points
48
Your Mac's Specs
Late 2013 rMBP, i7, 750m gpu, OSX versions 10.9.3, 10.10
can you upload your code? Looking at what you have posted, I can't see why it wouldn't work, so I'm thinking it's in your nib file causing the issue.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top