我在使用sdk中的initWithFrame:方法初始化的视图中使用了uitoolbar。我的意思是我添加工具栏porgramously。多任务时,这个工具栏正在创建问题。任何人都可以给我一些解决方案或光线来继续。我不能在xib中添加它,因为我正在使用自定义的uitablecontroller类。我的代码如下:UIToolBar在应用程序从后台返回时创建问题
-(void)viewDidLoad
{
[super viewDidLoad];
actionToolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 373, 320, 44)];
[actionToolbar insertSubview:[[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top-bar.png"]] autorelease] atIndex:0];
actionButton = [NotesList createSquareBarButtonItemWithTitle:@"Delete" target:self action:@selector(noAction:)];
flexibleSpace1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
flexibleSpace2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
composeButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCompose target:self action:@selector(addNewGroup:)]autorelease];
composeButton.style = UIBarButtonItemStylePlain;
[actionToolbar setItems:[NSArray arrayWithObjects:flexibleSpace1, flexibleSpace2, composeButton, nil]];
[self.view.superview addSubview:actionToolbar];
self.tableView.frame = CGRectMake(0, 0, 320, 400);
[self.tableView setAllowsSelectionDuringEditing:YES];
[flexibleSpace1 retain];
[flexibleSpace2 retain];
[actionButton retain];
[composeButton retain];
[self parseDataForThisFile];
}
应用的回报要澄清你所遇到的问题的代码?我不能帮助,除非你让我知道发生了什么 – theiOSDude 2011-05-12 12:41:24
你的问题到底是什么? – 2011-05-12 12:42:26
我的问题是,当应用程序从后台返回时,最初位于视图底部的工具栏移动到导航控制器正下方的视图顶部。只有在多任务处理和applicationWillEnterForeground方法被调用后,才会发生这种情况。 – DivineDesert 2011-05-12 13:28:39