按钮单击图像将显示锁定屏幕预览和主屏幕预览



我有一个照片库,还有一个动作表。图像来自滚动视图上的URL。因此,动作表中有两个按钮1)锁定屏幕预览和2)主屏幕预览单击按钮,它将显示锁定屏幕的外观,并且在主屏幕按钮上,它看起来像家庭壁纸。只是预览不要设置它们。我没有想法..请帮助我....

如果我很明白您这样做:

创建PreviewViewController并在ViewWillAppera委托中设置:

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
[imageView setImage:[UIImage imageNamed:@"image.png"]];
[self.view addSubview:imageView];

当您想调用预览时,请在Actionsheet委托方法中使用此信息:

- (void) actionSheet:(UIActionSheet*) actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex {
    if(buttonIndex == 0) {
        [self presentViewController:preview animated:YES completion:nil];
    }
}

您还可以在PreviewViewController中添加取消按钮,并在单击时删除视图:

-(IBAction)cancelButtonTaped:(id)sender {
    [self dismissModalViewControllerAnimated:YES];
}

最新更新