开发者

how to implement drop down menu

i have to select one category from drop down m开发者_如何学JAVAenu when i press a field ....without using picker view...


You can try to use a UIActionSheet like this:

UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"A title here"                                                        delegate:self 
cancelButtonTitle:@"Cancel"                                                destructiveButtonTitle:@"Dismiss" 
otherButtonTitles:@"One option", @"Another option", nil]; 

[action  showInView:self.view];

then implement the delegate methods like this one :

// Called when a button is clicked. The view will be automatically dismissed after this call returns
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
    switch (buttonIndex) {
        case x:
            //Chose option x
            break;
                     ...
        default:
            //Default action
            break;
    }
}


you would have to roll one of your own. What I did in this case is moved a picker view off screen and then when they hit the button it animates the movement of the picker view onto the screen. It then goes off when they pick.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜