Navigation bar with prompt - replace with image - objective-c

How can I make replace a "navigation bar with prompt" with a same size image?
I have seen this in other apps. All I can do is replace the navigation bar alone with no prompt. I want the size with the prompt so that I can put a heighty logo.
Thanks for any resource.

i hope this works for u.
self.navigationItem.prompt = #"";
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"YOUR IMAGE NAME"]];
imageView.frame = CGRectMake(self.view.frame.size.width/2, 0, 10, 10); //change height and width accordingly
[self.navigationController.navigationBar addSubview:imageView];
happy coding :)

Related

Why UIActivityIndicatorView is not showing on UIWebView?

Code:
CGPoint centerPoint = [_inner_web_view center];
CGRect frame = CGRectMake(centerPoint.x, centerPoint.y, 100, 100);
_activity_indicator = [[UIActivityIndicatorView alloc]
initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite];
[_activity_indicator setFrame:frame];
[_inner_web_view addSubview:_activity_indicator];
What I need is to display ActivityIndicator on UIWebView.
Even after using [_activity_indicator startAnimating] nothing happens. :(
Can someone help me find out WHY this happens?
Your Activity Indicator View's Style is White UIActivityIndicatorViewStyleWhite and UIWebView also has white background when loading. Try Gray Style UIActivityIndicatorViewStyleGray.

Position UILabel in area relative to screen resolution

I am trying to position UILabel relative to screen resolution (iPhone v iPad) so that the UILabel does not interfere with splash screen graphics at start-up. When the app was iPhone only, the label was located properly. Once the app was made universal, the Label interfered with the image on iPad (of course)
I am using the method below, which works fine, but it is not very forward thinking in terms of new devices and/or new screen resolutions.
Can anyone suggest a more efficient way to display the UILabel "Connecting to Server..." within the area circled in red on the attached image at the link below (I do not have auth to post images here yet)?
UILabel *loadingLabel;
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone)
{
loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 350, self.window.frame.size.width, 20)];
}
else
{
loadingLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 700, self.window.frame.size.width, 20)];
}
loadingLabel.text = #" Connecting to Server...";
loadingLabel.textAlignment = UITextAlignmentCenter;
loadingLabel.textColor = [UIColor whiteColor];
loadingLabel.backgroundColor = [UIColor clearColor];
Splash Screen
You can use the autoresizingMask property to accomplish it.
set your origin.y on the label to be self.window.bounds.size.height - 200 or so. Then set the autoresizingMask to be UIViewAutoresizingMakFlexibleBottomMargin

ios tableviewcell several objects one a cell programatically , setting prototype cell programatically , custom table view cell style,

hello I built this tableview using the InterfaceBuilder and storyboard I used custom for the style of the cell and content prototype of the table view, this is the image:
custom tableview
but now I need to redo everything programmatically I tried insert an imageview in the cell using this code
UIImageView *imgView = [[UIImageView alloc] initWithFrame:
CGRectMake(300, 0, 80, 80)];
imgView.image = [UIImage imageNamed:#"esquina_estrella.png"];
cell.imageView.image = imgView.image;`
but the image stays static unresponsive to CGRectMake thanks for you help
Use this code to the Cell:
// Make your frame origin 0,0 as below done.
UIImageView *imgView = [[UIImageView alloc] initWithFrame:
CGRectMake(0, 0, 80, 80)];
imgView.image = [UIImage imageNamed:#"esquina_estrella.png"];
[cell addSubview:imgView];
[imgView release];
imgView = nil;
Add
imgView.clipsToBounds = YES;
To limit display of the image to the frame of the image view.
Also, you are adding the image of the image view to the cell's image view, which is a different object, without using your image view and its frame. You actually do not need an image view if you are just using the image. What you want is
cell.imageView = imgView;
or
[cell.contentView addSubview:imgView];
The latter will be preferable if you want to place it exactly and add more image views as in your screen shot.

toolbar hide behind the navigation image

I am creating one app in which i have to use navigation image.
without navigation image i can see the toolbar option perfectly
navigation bar without image at app start up-home screen
navigation image after navigate to second page
now i am adding an image in my navigation bar using
UIImageView *topBar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 45)];
topBar.image = [UIImage imageNamed:#"top_cell.png"];
[self.navigationController.navigationBar addSubview:topBar];
now the navigation bar look like at home screen perfect
but in second page the toolbar option hidden
so how can i show toolbar above the image in navigation bar?
Try with
[self.navigationController.navigationBar insertSubview:topBar belowSubview:navigationBar];
It will insert your view under your navigation bar.
A second option is to use this code after yours:
[self.navigationController.navigationBar bringSubviewToFront: topBar]
that will put your top bar at the top of the view stack.
finally lots of work i found the solution first i have added image in viewWillAppear method then after i added my toolbar in viewDidAppear method just like below code
-(void)viewWillAppear:(BOOL)animated
{
// self.navigationController.navigationBarHidden = TRUE;
///// Edit Hiren
UIImageView *topBar = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 45)];
topBar.image = [UIImage imageNamed:#"top-bar.png"];
[self.navigationController.navigationBar addSubview:topBar];
}
-(void)viewDidAppear:(BOOL)animated
{
toolbar.frame = CGRectMake(0, 0, 685, 44);
// [toolbar sizeToFit];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:toolbar];
// [self.navigationController.view addSubview:toolbar];
}

Image at the top of the tableview

Hey I am making an app that has to show a big image at the top of the grouped tableview, I don't want the image to be in tablecell because it looks stupid that way. I just want the image to float there, but I have no idea how to do it? Thanks!
Use the table view's tableHeaderView property, like this:
UIImageView *topImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:#"my logo.png"];
topImage.backgroundColor = [UIColor clearColor];
topImage.frame = CGRectMake(0, 0, theTableView.bounds.size.width, 100); // replace 100 with the height of your image, plus a bit if you want it to have a margin
topImage.contentMode = UIViewContentModeCenter;
theTableView.tableHeaderView = topImage;
[topImage release];