1--> Suppose your main project is MainProject.xcodeproj, The very first step is open project in Xcode and add a new target (TargetProj)
2--> edit MainProject info from Target
3--> change TargetProj-Info.plist in Info.plist File Property
4--> and change targetProj in Product Name
Monday, January 24, 2011
Tuesday, January 4, 2011
Create Object of class to use as a View
in ChildClass.h
@interface
{
UINavigationController *ng;
id parentController;
}
@property(nonatomic, retain) id ParentController;
@property (nonatomic, retain) IBOutlet UINavigationController *ng;
in ChildClass.m
@synthesize ParentController = parentController;
@synthesize ng;
in ParentClss.m
ChildClass* childObject = [[ChildClass alloc]initWithNibName:@"ChildView" bundle:[NSBundle mainBundle]];
childObject.ParentController=self;
childObject.ng = self.navigationController;
[childObject.view setFrame:CGRectMake(Frame)];
[YourView addSubview:childObject.view];
[self.view sendSubviewToBack:YourView];
@interface
{
UINavigationController *ng;
id parentController;
}
@property(nonatomic, retain) id ParentController;
@property (nonatomic, retain) IBOutlet UINavigationController *ng;
in ChildClass.m
@synthesize ParentController = parentController;
@synthesize ng;
in ParentClss.m
ChildClass* childObject = [[ChildClass alloc]initWithNibName:@"ChildView" bundle:[NSBundle mainBundle]];
childObject.ParentController=self;
childObject.ng = self.navigationController;
[childObject.view setFrame:CGRectMake(Frame)];
[YourView addSubview:childObject.view];
[self.view sendSubviewToBack:YourView];
Monday, January 3, 2011
UIKeyboardTypeNumberPad missing "return" key
I get the code from Google and modify it for DONE Button in UIKeyboardTypeNumberPad (works in iPhone 4 SDK)
- (void)textFieldDidBeginEditing:(UITextField *)textField {
if(textField==txtZipCode)
{
[self setViewMovedUp:YES];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(keyboardDidShowOrHide:)
name: UIKeyboardDidShowNotification object:nil];
}
else
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
}
}
- (void) keyboardDidShowOrHide : (id) sender {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 427, 106, 53);
doneButton.adjustsImageWhenHighlighted = NO;
[doneButton setBackgroundImage:[UIImage imageNamed:@"doneup.png"] forState:UIControlStateNormal];
[doneButton setBackgroundImage:[UIImage imageNamed:@"donedown.png"] forState:UIControlStateHighlighted];
[doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
[tempWindow addSubview:doneButton];
}
-(void)doneButton:(id)sender
{
UIButton *btntmp=sender;
[btntmp removeFromSuperview];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
[self setViewMovedUp:NO];
[txtZipCode resignFirstResponder];
}
- (void)textFieldDidBeginEditing:(UITextField *)textField {
if(textField==txtZipCode)
{
[self setViewMovedUp:YES];
[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(keyboardDidShowOrHide:)
name: UIKeyboardDidShowNotification object:nil];
}
else
{
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
}
}
- (void) keyboardDidShowOrHide : (id) sender {
// create custom button
UIButton *doneButton = [UIButton buttonWithType:UIButtonTypeCustom];
doneButton.frame = CGRectMake(0, 427, 106, 53);
doneButton.adjustsImageWhenHighlighted = NO;
[doneButton setBackgroundImage:[UIImage imageNamed:@"doneup.png"] forState:UIControlStateNormal];
[doneButton setBackgroundImage:[UIImage imageNamed:@"donedown.png"] forState:UIControlStateHighlighted];
[doneButton addTarget:self action:@selector(doneButton:) forControlEvents:UIControlEventTouchUpInside];
UIWindow* tempWindow = [[[UIApplication sharedApplication] windows] objectAtIndex:1];
[tempWindow addSubview:doneButton];
}
-(void)doneButton:(id)sender
{
UIButton *btntmp=sender;
[btntmp removeFromSuperview];
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
[self setViewMovedUp:NO];
[txtZipCode resignFirstResponder];
}
Subscribe to:
Posts (Atom)