objective c - How to position progress spinner inside the title bar of a Mac application -
i trying place progress spinner @ right side of the title bar of window of mac os x application, can't interface builder, doesn't let me drag view inside it.
so, tried put in title bar programmatically, following code inside applicationdidfinishlaunching
method in appdelegate.m:
loadingspinner = [[nsprogressindicator alloc] init]; [loadingspinner setframe:nsmakerect(485, 0, 17, 17)]; [loadingspinner setstyle:nsprogressindicatorspinningstyle]; nsview *titlebarview = [[_window standardwindowbutton:nswindowclosebutton] superview]; [titlebarview addsubview:loadingspinner];
however, putting progress spinner view @ bottom of window instead of title bar. appears nsmakerect() positioning relative bottom of window, not top.
if change second parameter of nsmakerect (y position) 370, puts loading spinner in place want be, when resize window vertically, brings progress spinner bottom.
i've never seen before. how can fix that?
p.s.: also, don't know if there's "more right" way title bar view. can see, i'm using superview of close button view it, seems bit "dirty".
randall brown has code put button in nswindow's title bar on blog. on right track. superview of close button entire window including title bar. little less hacky [[_window contentview] superview]
.
Comments
Post a Comment