thermogl / TITokenField

An iOS version of the NSTokenField (See To: field in Mail and Messages).
http://thermoglobalnuclearwar.com/opensource/
600 stars 172 forks source link

search results table view looks wrong on iOS 7 #62

Closed zivl closed 11 years ago

zivl commented 11 years ago

Hi folks,

Please find the issue in the below image (the screenshot is taken from your latest example app): ios simulator screen shot sep 26 2013 11 07 28 am

I'm still trying to locate the wrong calculation but since you're more familiar with it i guess it will take less for you to fix it.

Thank you for your effort,

Ziv

thermogl commented 11 years ago

I think this is because of the UIViewController changes. If you create a fresh app I think it'd work as expected.

zivl commented 11 years ago

Thank you for the fast response! Unfortunately, it didn't work on a fresh new app. I might not using it right, have you succeeded doing so? Anyway, it is working only if my ViewController is not including a navigation controller. Here is my code:

SelectContactsViewController *selectContactsVC = [[SelectContactsViewController alloc] init];
    UINavigationController *navCtl = [[UINavigationController alloc] initWithRootViewController:selectContactsVC];
    [self presentViewController:navCtl animated:YES completion:nil];

EDIT: The "SelectContactsViewController" is the same as "TokenFieldExampleViewController" in the example but a few logic functionality changes

Any suggestions? Thanks a lot!

zivl commented 11 years ago

A temporary workaround that I've implemented is to add a UIToolBar programatically and make it look like a NavigationController. see the following lines in the "viewDidLoad" method of "SelectContactsViewController" class:

float toolBarHeight = NAVIGATION_BAR_HEIGHT + STATUS_BAR_HEIGHT;
UIToolbar *navigationItem = [[UIToolbar alloc] initWithFrame:(CGRect){
    self.view.frame.origin, {self.view.frame.size.width, toolBarHeight}
}];

[self.view addSubview:navigationItem];

_tokenFieldView = [[TITokenFieldView alloc] initWithFrame:(CGRect){{self.view.frame.origin.x, self.view.frame.origin.y + navigationItem.frame.size.height}, self.view.frame.size}];

where:

#define STATUS_BAR_HEIGHT 22;
#define NAVIGATION_BAR_HEIGHT 44;

of course it is working for me since my usage of the NavigationController is just for visual purpose of the title and buttons. But if one will need the NavigationController for navigation purposes then he might encounter difficulties.

I'll be happy to any suggestions and ideas, Cheers, Ziv