how to make a custom viewController with transparent black background? - iphone

I'm trying to make a viewController appears like the small one in the middle of the picture :
I tried with the UiAlertView, but it semms not offering this feature.
I found some apps adding buttons and labels, photo in similar viewControllers.
Any idea ?

It's not a view controller - it looks like a view that is added as a subview.

The middle View in the image is not a viewcontroller. It is just a custom UIView made up using images and buttons. You can set the transparency of a UIView using property alpha.
Example
yourview.alpha = 0.5;

Related

How to put my 2 existing buttons to the foreground, they are now behind an imageview

The question is in the title.
There must be a simpel way to do this I guess?
There is an imageview on the screen, there doesn't have to be any interaction with it.
On the imageview I want 2 small buttons left and right but the buttons were created (and the code is written) before the imageview. How do I set this imageview to the background? :)
[self.view sendSubviewToBack:yourImageView];
You can add buttons as subview of imageview.
you can write below code for that:
[imageView addSubview:button1];
[imageView addSubview:button2];
So buttons will be appear in foreground.
When looking at your xib or stoyboard (where you can see the layout), you can use the View Controller scene which is a list of all of the objects, views etc on your Apps layout.
You can click and drag the UI image view so its above the buttons in the list. I'm guessing it's just defaulted to being on top of the buttons.
In your storyboard, choose your viewController by clicking on it. On left side you can see hierarchy like left side view in this image. Check if your imageView is below, in hierarchy, to your 2 buttons. If it is, then drag the imageView and move it above both the buttons.
Concept : The view that is below in hierarchy is visible on top of all the views above it.

UIImage displaying incorrectly in a UIImageView

I have an XIB file that looks like this:
As you can see I have a UIImageView at the bottom of the view, note its all contained within the view.
However, when I run the code which places a UIImage in the view, I get this:
Here is the image I am trying to display:
Image
Why does it go off the bottom of the screen? I've seen similar behaviour in some of my other projects, whats going on?
Thanks,
Jack
In IB, for the top-level view, for the Simulated User Interface Elements, set the Top Bar to be one of the Navigation Bar options. Understand, you will!
hi jack you also do that change view size from interface builder like 320 &460

How to set this Layout in iPhone need Some help

I have Implement Some paint like application. For that the Layout is like as below:
Here, there is One View and two buttons. In My application i am selecting the colour from Button2 and then doing drawing on View.
But the Problem is while i am selecting the Colour and if i do the Paint on the View, all works file but if that paint come over the Button1, it also paint on that button1. I want set as like that the selection colour Should not be paint on the Button1 and only paint on the View.
So for that What Should i have to do ?
I want to set the Button1 in front of the View and do not allow to paint on it.
please Guide me proper regarding this mater.
Thanks.
You have to make sure your buttons are not subviews of the view you are drawing in.
The simplest way to do this is to organize your buttons and your view in interface builder so that you have a UIView within your window as well as your buttons which must be on a higher layer than your UIView but cannot be inside your UIView. I would post pictures if the site would let me. You will then need to make a UIView IBOutlet to attatch to the UIView in Interface Builder and to draw to in your code.
To do this programmatically, after you have created your buttons, create a UIView and add it as a subview to your viewController's view by using (if myView is your UIView)
[self.view addSubview:myView]
and then use
[self.view send SubviewToBack:myView]
to make sure it is behind your other subviews (your buttons). Draw to myView and it should appear behind the buttons.

iPhone Setting A Background Image

I want to use an image as a background for my application. I want the buttons to be over the image. How is this accomplished? Everytime I use image view it covers up the buttons.
The image view should cover your buttons unless you are placing it higher in the list of subviews. Make sure your image view subview is added first and the buttons (and all other views) will be displayed on top of it.
Are you doing this in Interface Builder or manually in code?
You could try using UIView's sendSubviewToBack method:
UIImageView view = / init view */;
// some additional code here
mainView.addSubview(view);
// add buttons, etc...
mainView.sendSubviewToBack(view);

Resizing UITableView on RootController

Is it possible to resize the UITableView on the RootController of a nav based app? When RootViewController.xib is opened in IB, there isn't a view. Just the UITableView. Clicking the inspector and then the little yellow ruler, frame height is grayed out. I'm adding a toolbar programmatically to the RootViewController:
[toolbar setFrame:rectArea];
That works fine but the bottom cell in the tableview is partially hidden because the tableview doesn't know about the toolbar.
The easiest way, is to adjust the contentInset (which is inherited from UIScrollView). Resizing by setting the frame can cause crazy drawing bugs in cells.
For example, if you are trying to resize a tableview for the keyboard, do something like this:
tableView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 216.0, 0.0);
tableView.scrollIndicatorInsets = tableView.contentInset;
Hope that helps someone. This way worked best for me.
Yes, but you need to have a ViewController (not a UITableViewController) as the root controller for the nav, and wrap the actual UITableView in the UIViewControllers view.
You can still have the UIViewController conform to the UITableViewDelgate and Datasource protocols, and use all the same methods you have now in your UITableViewController.
P.S. you'll get more responses if you use the plain "iphone" tag.
You could also just set the Content and Scroller inset of the tableview
I encountered a similar issue when attempting to display the detail controller by itself, see: http://vimeo.com/13054813
The issue is that the SplitView controller applies its own transform to the sub-controllers, taking them out of the orientation detection loop, which blows goats and seems incredibly 'hackish' for built-in classes. (The video illustrates what happens when you make the detail view the root view, then add it back to the split view and make the split view root while in landscape; you get double rotation of the detail view.)
Unfortunately I've again run into these transformation issues while attempting to resize a SplitViewController's detail sub-view in response to the keyboard appearing/disappearing. In portrait, all works fine, in landscape it's fscked.
Yes, adjust the contentInset and scrollIndicatorInsets are the convenient way to resize the UITableView.
As the answer of Sam Soffes posted, I succeed resize UITableView in UITableViewController for the bottom UIToolbar.