NOrder
NOrder

Reputation: 2493

cocoa: is there any way to custom the view(such as ABPeoplePicker View) supplied by Cocoa library

I need to use ABPeoplePickerView to implement my AddressBook application. the view in IB is like this: enter image description here

and it's like the following after running: enter image description here

I want to delete the search field and add a button(like "add") on the top, but I don't know how to change the view layout. Is there any way to do it?

Upvotes: 0

Views: 101

Answers (2)

AlexT
AlexT

Reputation: 616

This function finds the search field. Hopefully it may point the way for you to proceed.

extension ABPeoplePickerView {
  func searchField () -> NSSearchField?{
    for v in self.subviews[0].subviews {
      if v.isKind(of: NSSearchField.self) { return (v as! NSSearchField) }
    }
    return nil
  }
}

Upvotes: 0

Frederik Slijkerman
Frederik Slijkerman

Reputation: 6529

You can subclass the view to customize it.

Upvotes: 1

Related Questions