开发者

Modal uiactionsheet ipad that cannot be dismissed

开发者 https://www.devze.com 2023-02-17 23:43 出处:网络
How do I create an UIActionsheet on the iPad without having it dismissed by tapping the area aroun开发者_运维知识库d the action sheet? This is default on the iPhone, any luck on the iPadI faced the sa

How do I create an UIActionsheet on the iPad without having it dismissed by tapping the area aroun开发者_运维知识库d the action sheet? This is default on the iPhone, any luck on the iPad


I faced the same problem and I came up with a workaround more than a solution.

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    NSLog(@"%d",buttonIndex);
    switch (buttonIndex) {
        case -1:
            [self presentOptions];
    //.... more cases here
    }
}

When the user taps outside the UIActionSheet you get a -1 as buttonIndex. In that case I presented the UIActionSheet again (by calling my method presentOptions that just presents the action). From the users perspective you can see a tiny blink un the UIActionSheet: hardly noticeable. Not a perfect solution but and acceptable workaround I'd say.

0

精彩评论

暂无评论...
验证码 换一张
取 消