xcode - iOS Swift Tab Bar Icon Insets Being Erased At Runtime -


i have 2 viewcontrollers inside tab bar controller. in interface builder, i've applied image insets (5, 5, 5, 5) tab bar icons sizes how want them. looks great when run simulator, when tab second viewcontroller, both tab bar icons automatically resize default (0, 0, 0, 0). when tab return first viewcontroller, both icons remain trapped @ default size no insets.

note: icon images .pdf files in xcassets folder (set single vector scale factor). i've seen other threads suggest "balancing" insets (5 top, -5 bottom). compress image 5 away top , stretch 5 toward bottom. don't see how that's meant balance image size.

if knows code set insets @ runtime, maybe use instead of setting insets in interface builder? in advance.

reading documentation, uibaritem (superclass of uitabbaritem) has property imageinset, , can access tab bar items via self.tabbarcontroller.tabbar.items.

without testing myself, think may have issue insets getting reset when shading changes (because of selection).

thus, may find every time change selection (and can detected via delegate think), you'll need reset insets desired size.

alternatively, might find customizing source image desired final appearance may easier.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -