chenqihui / IMFiveApp

低仿QQ5.0
124 stars 76 forks source link

UIImagePickerController代理方法不执行 #2

Closed RoshanDev closed 10 years ago

RoshanDev commented 10 years ago

现在在项目中UIImagePickerController的代理方法不执行,求助攻。

_imagePicker = [[UIImagePickerController alloc] init]; _imagePicker.delegate = self; NSLog(@"delegate1 = %@",[_imagePicker.delegate class]); [self presentViewController:self.imagePicker animated:YES completion:^{ NSLog(@"delegate2 = %@",[_imagePicker.delegate class]); }];

打印出来的是下面的 2014-11-10 14:48:35.340 SOWOClient[10041:60b] delegate1 = SWChatViewController 2014-11-10 14:48:35.881 SOWOClient[10041:60b] delegate2 = PUUIAlbumListViewController

正常的应该两个都是SWChatViewController

chenqihui commented 10 years ago

我觉得你是不是合并了几个其他开源工程在一起了! 你说的这些我这个工程没有呢,我有点云里雾里~

RoshanDev commented 10 years ago

额,这个是我自己加的一个ViewController的。现在不知道怎么把我加的这个ViewController发给您,里面代码很少的

chenqihui commented 10 years ago

你github工程不是有么!! 你说明清楚在哪里,

RoshanDev commented 10 years ago

在DynamicViewController.m中加了两个代理,现在是UITableViewDataSource, UITableViewDelegate, UINavigationControllerDelegate, UIImagePickerControllerDelegate四个

在- (void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath方法中添加了下面的代码 UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; imagePicker.delegate = self; imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; imagePicker.allowsEditing = YES; NSLog(@"_imagePicker.delegate = %@",imagePicker.delegate);

[self presentViewController:_imagePicker animated:YES completion:^{
    NSLog(@"_imagePicker.delegate2 = %@",imagePicker.delegate);
}];

还添加了UIImagePickerControllerDelegate的代理方法。 现在代理方法不响应。

chenqihui commented 10 years ago

你不check in代码么

RoshanDev commented 10 years ago

额,不会弄这个。刚才好像弄错了,sorry

chenqihui commented 10 years ago

NSLog(@"_imagePicker.delegate2 = %@",_imagePicker.delegate);

这里你需要做什么呢??“PUUIAlbumListViewController”应该是内部的,你想做什么的

RoshanDev commented 10 years ago

额,关键是我没有把代理赋值给PUUIAlbumListViewController啊。是present了imagePicker之后自动改成了这个o(╯□╰)o。搞了老长时间没搞明白。很纠结

chenqihui commented 10 years ago

嗯嗯,我也不是很清楚问题原因,晚点再看看是否能找到原因吧

RoshanDev commented 10 years ago

(⊙v⊙)嗯,O(∩_∩)O谢谢了。感谢(^o^)/~

chenqihui commented 10 years ago

你注释AppDelegate里面的 [UIViewController validatePanPackWithMLTransitionGestureRecognizerType:MLTransitionGestureRecognizerTypePan]; 就可以了。

MLTransition这个加的是别人开源的,需要自己了解里面的情况,具体原因你看看你是否可以找出,能找到告诉我啰~~

RoshanDev commented 10 years ago

里面全是黑魔法,鸭梨山大

RoshanDev commented 10 years ago

https://github.com/molon/MLTransition 最新版本的好像已经支持了~(≧▽≦)/~啦啦啦。 再次感谢

chenqihui commented 10 years ago

那就好~~

Jeswang commented 9 years ago

好大一个坑,多谢提前把坑踩了 @pibao2013