2 bluetooth99 bluetooth99 于 2013.07.04 15:32 提问

导航条不显示取出图片

有一个按钮用来从相册中取图片。取出的图片要显示在导航条和分享按钮中。但是导航条并不显示。我用了[self.navigationController.navigationBar setHidden:NO];

-(void)showAlbum:(id)sender{
    imagePicker=[[UIImagePickerController alloc]init];
    imagePicker.delegate = self;
    imagePicker.allowsEditing =NO;
    imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentModalViewController:imagePicker animated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
    //release picker
    [picker dismissModalViewControllerAnimated:YES];

 }
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    //set image
    [self.navigationController.navigationBar setHidden:NO];
   newImage = [[UIImageView alloc] initWithImage:[info objectForKey:UIImagePickerControllerOriginalImage]];
    [newImage setFrame:CGRectMake(0, 0, 320, 568)];
[self.view addSubview:newImage];
  [picker dismissModalViewControllerAnimated:YES];
}

1个回答

zhanglei5415
zhanglei5415   Rxr 2013.07.04 16:42

你的代码中取出图片后,添加到当前视图上去了,而没有添加到导航条的代码,怎么可能有你要的效果

 [newImage setFrame:CGRectMake(0, 0, 320, 568)];
[self.view addSubview:newImage];

不太确定你想要实现什么样的效果,最好能贴一个你想实现的效果图上来。

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!