I want to know which UIBarButtonItem
enumerated in self.toolbarItems
is a button and which is flexible space item.
As A-Live confirmed my findings that one is not able to query the UIBarButtonItem to check if it is FlexibleSpace (or FixedSpace) I've used tag to mark those items as flexible and fixed space (2 different integers) and put those numbers in the constant then in code I use:
for(int i=0; i<self.toolbarItems.count; i++)
{
if(item.tag != TOOLBAR_FIXED_SPACE_TAG &&
item.tag != TOOLBAR_FLEXIBLE_SPACE_TAG)
{
//count real button:)
}
}
The answer above I wasn't able to get to actually work, so I used this. Hopefully this can help someone:
for(int i=0; i<[buttonArray count]; i++){
UIBarButtonItem *buttonItem = [[self items] objectAtIndex:i];
if(buttonItem.title){
NSLog(@"Double Boom %@", buttonItem);
}
}
** Flexible/Fixed space doesn't contain a title... This is the only real difference I could immediately see. So, I am literally just checking for a title.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With