Ø (18)Programatically
UIToolbarButton
Load()
{
[super viewDidLoad];
UIToolbar*
numberToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar.barStyle = UIBarStyleBlackTranslucent;
numberToolbar.items = [NSArray arrayWithObjects:
[[UIBarButtonItem alloc]initWithTitle:@"Cancel"
style:UIBarButtonItemStyleBordered target:self
action:@selector(cancelNumberPad)],
[[UIBarButtonItem
alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil
action:nil],
[[UIBarButtonItem
alloc]initWithTitle:@"Apply" style:UIBarButtonItemStyleDone
target:self action:@selector(doneWithNumberPad)],
nil];
[numberToolbar
sizeToFit];
t1.inputAccessoryView = numberToolbar;
[super
viewDidLoad];
UIToolbar*
numberToolbar1 = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, 320, 50)];
numberToolbar1.barStyle = UIBarStyleBlackTranslucent;
numberToolbar1.items = [NSArray arrayWithObjects:
[[UIBarButtonItem
alloc]initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered
target:self action:@selector(cancelNumberPad1)],
[[UIBarButtonItem
alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil
action:nil],
[[UIBarButtonItem alloc]initWithTitle:@"Apply"
style:UIBarButtonItemStyleDone target:self action:@selector(doneWithNumberPad1)],
nil];
[numberToolbar1
sizeToFit];
//t1.inputAccessoryView = u1;
//
t2.inputAccessoryView = u1;
}
-(void)cancelNumberPad
{
[t1
resignFirstResponder];
t1.text =
@"";
}
-(void)doneWithNumberPad
{
[t1
resignFirstResponder];
}
-(void)cancelNumberPad1{
[t2
resignFirstResponder];
t2.text =
@"";
}
-(void)doneWithNumberPad1
{
[t2
resignFirstResponder];
}
No comments:
Post a Comment