iphone - iOS5 中 UIPickerView 选择 RowInComponent 的不同奇怪行为

标签 iphone ios ios5 sms uipickerview

iOS5 更新后,我的应用程序现在发生了一件奇怪的事情。

我有一个 UIPickerView 并使用 [customPickerView selectedRowInComponent:0]获取选择的组件。用户选择第二行(索引为 1)

所以它看起来像:

i = [customPickerView selectedRowInComponent:0];   // -> i is 1 here, is OK!
[smsAgent  sendSMS:smsTxt]; //just call another method to send a SMS
i 的值检查时没问题。
现在我只需调用一个正常的短信对话smsAgent基本上看起来像这样:
smsAgent...
      MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
      picker.messageComposeDelegate = delegate;
      picker.recipients =[NSArray arrayWithObject: myTelNumber];  
      [delegate presentModalViewController:picker animated:YES];

当然不会对我的选择器做任何事情。

但是当这个“回归”在
    - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
        [self dismissModalViewControllerAnimated:NO]; //take away the SMS screen fast, so we can send selectModeVCDidFinish to take away ourselves
        int j = [customPickerView selectedRowInComponent:0];
        [self.delegate selectModeVCDidFinish: selectedMode];
}

j 再次为 0,而不是 1 !

当然,customPickerView 没有任何 react ——我真的很困惑——这是怎么回事?

在升级到 iOS5 之前没有任何问题。

有什么我错过的吗?

非常感谢

最佳答案

感谢您详细解释问题。我的 UIPickerViews 有问题。正如我在上面的评论中提到的,我的代码基于 CustomPickerView - http://iphonedevelopment.blogspot.co.uk/2009/02/longer-spinning-blurring-v20.html

此代码与 5.0 版本不同。经过大量研究后,我发现 UIPicker 调用委托(delegate)函数的顺序/顺序不是问题。

但特别是非官方功能“scrollAnimationDuration”已被弃用且无法使用。这就是 UIPicker 不滚动更长时间的原因(就像它在 iOS 4.3.3 及更低版本中所做的那样)。

关于iphone - iOS5 中 UIPickerView 选择 RowInComponent 的不同奇怪行为,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7862550/

相关文章:

iphone - 如何在具有间隔的辅助线程中调用函数?

iphone - 如何将运行 iOS 5 的 iPhone 静音

ios - 如何在 iOS 应用程序启动前打开 ViewController

iPhone - 使用与加密所用 key 不同的 key 解密 AES 加密消息

iphone - 带有 Web 服务的核心数据推荐模式?

ios - 如何通过点击 Swift 中的按钮来打开 Facebook 和 Instagram 应用程序

ios - SceneKit中如何实现运动模糊效果?

ios - 使用 Airplay iphone sdk 进行实时视频流传输

android - Apple 彩色表情符号字体如何工作,是否有 Android 版本?

iOS 套接字连接崩溃