ios - How to add a badge on UIButton and manage orientation -
this question has answer here:
i trying create shopping cart application , on adding product want add badge
on uibutton
increase or decrease accordingly .
i searched google end solution " mknumberbadgeview "
(https://www.cocoacontrols.com/controls/mknumberbadgeview)
i creating application supports iphone4/5 afraid add sub view in view controller , manage on iphone 4 & 5
.
can 1 suggest better solution can badge on uibutton
along also supports orientation
. or solution handle subview both devices 4 & 5.
thanks in advance .
managing whether iphone 4 or 5 not ton of work, makes difference when initialize button , it.
you can getting screen size using following code
cgrect screenbounds = [[uiscreen mainscreen] bounds]; if (screenbounds.height == 568) { // iphone 5 } else if (screenbounds.height == 480) { // iphone 4s or below } else { // other device, maybe ipad? }
then add button in way, pretty straightforward
Comments
Post a Comment