totalitarian totalitarian - 3 months ago 12
Objective-C Question

UIBarButtonItem: How can I find its frame?

I have a button in a toolbar. How can I grab its frame? Do

UIBarButtonItem
s not have a
frame
property?

Answer

Try this one;

UIBarButtonItem *item = ... ;
UIView *view = [item valueForKey:@"view"];
CGFloat width;
if(view){
    width=[view frame].size.width;
}
else{
    width=(CGFloat)0.0 ;
}