【问题标题】:How to display only phone number in contact list in iPhone?如何在 iPhone 的联系人列表中只显示电话号码?
【发布时间】:2011-06-23 05:28:30
【问题描述】:

我在 iPhone 应用中打开了默认联系人列表。
现在我想当我选择任何联系人时,它应该只显示该联系人的电话号码,而不是任何其他信息。
如果该联系人没有电话号码,则应仅显示“无电话号码”。
如何做到这一点?

【问题讨论】:

    标签: ios iphone contacts phone-number addressbook


    【解决方案1】:

    ABPersonViewController 有一个displayedProperties 属性,您可以在其中定义要显示的内容。

    ABPersonViewController *controller = [[ABPersonViewController alloc] init];
    
    NSArray *properties =
        [NSArray arrayWithObjects:
         [NSNumber numberWithInt:kABPersonPhoneProperty], nil]
    [controller setDisplayedProperties:properties];
    

    【讨论】:

      【解决方案2】:

      当您选择任何一个联系人时,都会调用一个委托方法,

      peoplePickerNavigationController:shouldContinueAfterSelectingPerson

      你只需要设置displayedProperties,这里只能设置Phone number,

      希望此链接对您有更多帮助 http://developer.apple.com/library/ios/#documentation/ContactData/Conceptual/AddressBookProgrammingGuideforiPhone/Chapters/UI_Controllers.html%23//apple_ref/doc/uid/TP40007744-CH5-SW1

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-03-14
        • 1970-01-01
        • 1970-01-01
        • 2013-05-19
        相关资源
        最近更新 更多