如何创建一个iPhone专辑中的"电子邮件照片,彩信,指定联系.."喜欢滑动?

StackOverflow https://stackoverflow.com/questions/2486362

我学会了如何创建一个图控制和使景下滑从底部。但是,一个在册看起来不同。它变暗的其余部分可见的屏幕时的图片。我如何创建一个类似的一个吗?我想添加按钮就像"保存、取消电子邮件"等的滑动图。

有帮助吗?

解决方案

这实际上不是一个典型的"滑动"(或模式)的看法,但一个 UIActionSheet.基本上,这个想法是你的初始化图(通常在你看来控制器)与

UIActionSheet *sheet = 
    [[[UIActionSheet alloc] initWithTitle:@"My sheet"
                                 delegate:self
                        cancelButtonTitle:@"Cancel"
                   destructiveButtonTitle:nil
                        otherButtonTitles:@"Email", @"MMS", nil] autorelease];

然后本使用

[sheet showInView:[self view]];

一旦它的屏幕、代表(self,或者你的图控制器,在这个例子)将收到 UIActionSheetDelegate 消息 actionSheet:clickedButtonAtIndex: (以及一些其他人;看到文件上),所以你要加入 <UIActionSheetDelegate> 你界宣言》的委托,实施这一方法,就像

- (void)actionSheet:(UIActionSheet *)actionSheet 
    clickedButtonAtIndex:(NSInteger)buttonIndex {
    switch(buttonIndex) {
        // Do things based on which button was pushed
    }
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top