Are there examples of how to use UIPopoverController on iOS?

后端 未结 2 1684
有刺的猬
有刺的猬 2020-12-10 00:26

I\'ve seen some demos where UIPopoverController is used and would like to use it in my apps.

So does anyone have any good tutorials that you could link me?

I

相关标签:
2条回答
  • 2020-12-10 00:46

    Here are some tutorials:

    • iPad for iPhone Developers 101: UIPopoverController Tutorial
    • [iPad App Video] iPad App Tutorial – UIPopoverController

    Segmented Popover:

    • Using a UISegmentedControl in the footer of UIPopoverController
    • Buttons inside of a Pop Over Controller on the iPad, no UISegmentUISegmentedControl used but looks like one
    0 讨论(0)
  • 2020-12-10 01:02
    1. For popover in iPad we can use ActionSheetStringPicker, and for implementing it in your project you need to import ActionSheetStringPicker into your controller. like - #imaport "ActionSheetStringPicker.h"

    2. After importing this you have to create an array which has only string type value.

    e.g.

       NSArray *sourceArray=[[NSArray alloc]initWithObjects:@"Take Photo",@"Choose Photo", nil];
    
    1. And last you have to implement below method.

      [ActionSheetStringPicker showPickerWithTitle:@"Any title"
                                                  rows:sourceArray
                                      initialSelection:yourInitialSelectionIntValue
                                             doneBlock:^(ActionSheetStringPicker *picker, NSInteger selectedIndex, id selectedValue) {
      
                                             NSLog(@" Index : %ld, value : %@",
                                                   (long)selectedIndex, selectedValue);
                                             if ([selectedValue isEqualToString:@"Choose Photo"]) {
      
                                                 // open photo lib
                                                 [self youerMethdeOpenPhotoLib];
      
                                             }
                                             else
                                             {
                                                 // open Camera
                                                 [self yourMethodOpenCamera];
                                             }
      
      
      
                                         }
                                       cancelBlock:^(ActionSheetStringPicker *picker) {
                                           NSLog(@"Select photo Cancel");
      
                                       }origin:YourTapButtonObject];
      
    0 讨论(0)
提交回复
热议问题