【问题标题】:Adding UIImagePickerController as a subview将 UIImagePickerController 添加为子视图
【发布时间】:2014-11-12 22:08:15
【问题描述】:

我想在自定义框架中添加 UIImagePickerController,因此一直在关注一些关于将 UIImagePickerController 视图添加为子视图的帖子。

几个问题:

  • 如何调整此子视图的框架?
  • 添加为子视图后,触摸似乎被禁用(我无法浏览照片或按取消按钮),我该如何解决?

非常感谢!

我的代码:

self.imagePicker = [[UIImagePickerController alloc] init];
self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.imagePicker.delegate = self;

//This is a subview of self.view. 
[self.pickerControllerHolderView addSubview:self.imagePicker.view];

// This seems to adjust the size of the view, but squashes the view. 
// self.pickerControllerHolderView.transform = CGAffineTransformMakeScale(1, 0.5);

【问题讨论】:

    标签: ios objective-c


    【解决方案1】:

    这个类的内部是私有的,它不应该被添加为子视图。它是一个独立的视图控制器和导航控制器,很可能无法按照您的预期工作。如果您需要自定义 UI 来挑选照片,您应该访问 ALAssetsLibrary 并自己显示内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-06-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-30
      • 2010-12-01
      相关资源
      最近更新 更多