objective c - NSStatusItem too short, text cut off -


i have status item:

@property (nonatomic, strong) nsstatusitem* item; 

that create way:

item=[[nsstatusbar systemstatusbar] statusitemwithlength: nsvariablestatusitemlength]; item.menu= self.menu; item.image= icon; item.highlightmode= yes; 

the icon 20x20, , other icon setting attributed title:

nsdictionary* attr= @{nsforegroundcolorattributename : [controller color],                        nsfontattributename : [nsfont userfontofsize: 12.5]}; item.attributedtitle=[[nsattributedstring alloc]initwithstring: @"12190"                                                  attributes: attr]; 

the problem status bar still getting cut off:

enter image description here

it should display whole number, gets cut off digit '9'. wrote application when there still os x 10.8, , text not getting cut. if not mistaken it's doing os x 10.10.

had similar issue setting nsstatusitem title property. came when went empty text nonempty text in item.title value. when title changed second time text cut off fixed. me solution set item.title twice when previous value empty string.

example code:

nsstring *title = @"status text"; // if previous value empty set title twice fix cut off issue if (item.title.length == 0) {   [item settitle:title]; } [item settitle:title]; 

Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -