UIActionSheet programatically in code

    UIActionSheet *actionsheet = [[UIActionSheet alloc]initWithTitle:@"Eezy" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Delete" otherButtonTitles:@"Ok", nil];
    [actionsheet showInView:self.view];

Delegate Method

- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
    if (buttonIndex == 2) {
        NSLog(@"Cancel");
    }
    else if (buttonIndex == 1) {
        NSLog(@"Ok");
    }
    else if (buttonIndex == 0) {
        NSLog(@"Delete");
    }
}
    var actionSheet = UIActionSheet(title: "Eezy", delegate: self, cancelButtonTitle: "Cancel", destructiveButtonTitle: "Delete", otherButtonTitles: "Ok")
    actionSheet.showInView(view)

Delegate Method

func actionSheet(actionSheet: UIActionSheet, clickedButtonAtIndex buttonIndex: Int) {
    if buttonIndex == 2 {
       println("Ok");
    }
    else if buttonIndex == 1 {
       println("Cancel");
    }
    else if buttonIndex == 0 {
       println("Delete");
    }
}

Instance Methods

Implementation in progress

Advertisements