iphone - UItextField within UISearchbar failing after iOS 7 upgrade -


i have uitextfield uisearchbar working until ios 7 upgrade , fails @ line: uitextfield *textfield=(uitextfield*)[[searchbar subviews] objectatindex:1];

any idea how fix this? thanks

    // search bar searchbar = [[uisearchbar alloc] initwithframe:cgrectmake(0.0, 0.0, 190.0, 44.0)]; searchbar.autoresizingmask = uiviewautoresizingflexiblewidth; uiview *searchbarview = [[uiview alloc] initwithframe:cgrectmake(90.0, 0.0, 230.0, 44.0)]; searchbarview.autoresizingmask = 0; searchbar.delegate = self;  searchbar.layer.bordercolor=[uicolor whitecolor].cgcolor;  uitextfield *textfield=(uitextfield*)[[searchbar subviews] objectatindex:1];  [searchbarview addsubview:searchbar];  self.navigationitem.titleview = searchbarview; 

try , it's work in both ios6 , ios7+ , safe approch

[[uitextfield appearancewhencontainedin:[uisearchbar class], nil] setfont:[uifont fontwithname:@"arialmt" size:10]]; 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

iphone - Three second countdown in cocos2d -

java.util.scanner - How to read and add only numbers to array from a text file -