iphone - Size of Image on UINavigationBar -
i want put custom image on uinavigationbar,
when tried 2 code snippets,
[self.navigationitem settitleview:[[uiimageview alloc] initwithimage:[uiimage imagenamed:@"logo.png"]]];
and
uibutton *logoview = [[uibutton alloc] initwithframe:cgrectmake(0,0,70,30)]; [logoview setbackgroundimage:[uiimage imagenamed:@"logo.png"] forstate:uicontrolstatenormal]; [logoview setuserinteractionenabled:no]; self.navigationitem.titleview = logoview;
image can see on device getting blur or getting streched.
i made image resolution of 180*40
(width*height)
i want know exact size of image. what, ?
thanks in advance.
use
uiimageview *navigationimage=[[uiimageview alloc]initwithframe:cgrectmake(0, 0, 98, 34)]; navigationimage.image=[uiimage imagenamed:@"topnav-logo.png"]; uiimageview *workaroundimageview = [[uiimageview alloc] initwithframe:cgrectmake(0, 0, 98, 34)]; [workaroundimageview addsubview:navigationimage]; self.navigationitem.titleview=workaroundimageview;
hope helps.
Comments
Post a Comment