我正在尝试UIView
从NSNotification
. 当我按下“完成”按钮时,应用程序应该删除screen3
,但它不起作用。有什么建议么?这里有代码:
- (void) mostrarCompra:(NSNotification *) notification
{
[self buyView:self];
}
- (void)buyView:(id)sender
{
screen3 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];
screen3.backgroundColor= [UIColor grayColor];
UIToolbar* tabBar = [UIToolbar new];
tabBar.barStyle = UIBarStyleDefault;
[tabBar sizeToFit];
[tabBar setFrame:CGRectMake(0,0,self.view.bounds.size.width,60)];
UIBarButtonItem *atras = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:self action:@selector(returnBuy:)];
[tabBar setItems:[NSArray arrayWithObjects:atras,nil]];
[screen3 addSubview:tabBar];
[superwindow addSubview:screen3];
}
- (IBAction)returnBuy:(id)sender{
[screen3 removeFromSuperview];
}
谢谢。