I have an application , that has one mainviewcontroller with some button.When i click setting button in my application , i have added onesubview to MainView ([self.view addSubview:SettingSubView];)
Its work fine.subview frame width=200 and height=200.That subviews shows front of the mainview with center place adjusted.What i want is when subview is added to mainview, that time i dont want user interaction with mainview.Thats trick should be done in UIAlertView.When alertview is shown we cant able to touch anything in the mainview.i want to do same thing using subview.
One more thing is i dont want to add this subview as alert subview.
Is it possible ?
thanks in advance.......
Instead of making your SettingSubview a direct subviews of the main view, place a view in-between. This view should cover the entire main view and have a transparent (clearColor) background color.
Main view
-transparent view
--SettingSubview view
Try using UIActionSheet that would do, as i have done the same for one of my app
Related
I am currently developing as app for iPad. And I need to create a tabbar. The problem is that, for design purposes, I need the tabbar to be on the top half of the screen and not on the bottom as it is on the default tabbar controller.
Once the tabbar is on top I want that when a button is touched, the subview bellow the tab is changed. Furthermore, the subview that should be loaded was alson designed inside the storyboard. The following sketch shows what I want it to look like:
On my research I found a solution (here) for putting the tabbar on top. Now my problem is on loading a subview bellow it.
I tried it with [self.view addsubview:theNameOfTheViewCreatedINStoryboad.view] but the application simply hangs when I press the button.
I think that is because I am not specifying anywhere what should be the dimension of the new view or where on the scree should it be placed. The reason for that is because I do not know where it should be done.
Can anyone give me some lights on this matter? Is the referred approach the best one for putting a tabbar on top? How can I solve the subview problem?
Glad to see you are using a toolBar and not a tabBar. Even better would be to create a custom content view controller.
You should be looking into using containment:
UIViewController containment
How does View Controller Containment work in iOS 5?
positioning UIViewController containment children
check out the docs
I have a UINavigationController App. I want to add a small bar just below the UINavigationBar, around 20px height. y application is almost finished, so I want to rebuild as less code as possible. For example, if I wanted to add a button in the bottom of every view of my application, I can do that by extending UIViewController with a category, and adding a UIButton as a subview of the current controller view, maybe in the viewDidLoad method.
This approach works fine, and so I can add my UILabel to all my views at the top of them. The problem is that it does not TAKE SPACE. It is always on top of my previous views (UITableView...). What is the best way (or just one way) to accomplish such a thing without having to create for example a view with 2 frames, and having all my main views extending it?
I thought of changing UINavigationBar height, but that is definitely not an option.The prompt property of UINabivationBar is just to big (around 30px).
I also tried to create a new view in the viewWillAppear method of every UIViewController, adding to that view my breadcrumb subview, and the original view, but it is not working.
Any ideas on this?
Thank you!
If I were you, I'd make a new UIView subclass to represent this thing, and embed it on the views of the individual UIViewControllers. They can get at the navigation stack by looking at the UINavigationController's .navigationControllers array, walk that and get view titles, etc.
I did a simple view based application.
I need to place three textfields in an alert view.
it is not possible According to UI guidelines.
So that i crate a view just like an alert view,And place text field in them.
Add it as subview to mainview while tap on a button.
Now what i need is when ever tap on button i need to disable userinteraction to main view,and enable userinteraction to the subview.
For that i am trying this code on button click event.
[object.viewController.view setUserInteractionEnabled:NO];
here object is object of appdelegate class.
But,if i place this it disables userinteraction of subview also.
But i need to disable for only main view.
i think people get what my problem,
if not let me add a comment.
Thank u in advance.
You can add UITextField inside UIAlertView, so it will cover main view so (as you required) user could not interact with the main view.
Similar thread which discuss UITextField in UIAlertView on iPhone - how to make it responsive?
Here is You tube video to add UITextField inside UIAlertView
I hope it will resolve your problem.
i resolve my problem,instead of disable of user interaction of main views i disabling user interaction for contents in the view(Buttons,textfields...).
And enabling then when sub view while closing sub view.
Let me Know if there is any Better way than this.
try using an action sheet. they;re much more flexible. on second thought check out InputAlertView in this
i have a little problem on my view.
I have a uiviewControler, load a xib.
on this view i have a UIButton ( on touch it's work fine)
I add a subview create by code (on a different class )
this view respond to her touch event.
when i add this subview on my view, the event on this view are ok, but the UIButton on my first uiview not work.
I have make an error ?
EDIT :
i have make some tests.
my uiview is not really load alone. in fact i load a new uiviewController, and add it's subview to my current uiviewController.
And my problem it's due to the transparence of my new uiviewController was intercep my touch event.
If the subview's area overlaps the button it will prevent it from working. If the subview is displayed modally it will prevent the button from working. Otherwise, the button should work fine.
Your problem is most likely somewhere else.
I have change my structure code, mow my view is only manage by his class ( herited from uiview ) and i have no uiViewController just for manage this.
On the apple documentation they say the uiview controller is for manage multiple uiview on windows, and in my old code not respect this.
i'm having a real trouble with UITabBarController. I have a simple foto app, and I'm trying to simulate almost the same behaviour as the PhotoApp from the Iphone
the main view controler is the tabbar itself, i also have a NavBar and a status bar on top.
What i want is on tap to hide the bars (not with timer, just on tap).
The photo is actually an UIScroll view that zooms the photo or makes it again 1:1. that part already works,
I've tried before pushing the view to the navbar to set the hidesBottomBarWhenPushed and well it works, but i can't set a custom animation, and that's not the real problem , I can't show again the bars, they dissapear and i don't know how to reshow them, i'm sure i'm probably missing someting very obvious, but as my experience in obj C is little like half a year part time, i thought i asked here as stackoverflow seems to get the answers :)
Something to investigate: the Three20 project: http://github.com/facebook/three20 - it includes a completely clone of the photo-browsing app in component form.
But without Three20, you can't do this with a stock UINavigationController, because the UIViewController that you're using is a subview of the UINavigationController. You need to make a sibling view on another layer. To do this, make a parent UIViewController which has two subviews: your photo, and a UIToolbar. You can hide and display the UIToolbar by setting it's hidden property, and make sure it's above the photo view with [parent.view bringSubviewToFront:toolbarController] (where parent is the main UIViewController that contains both the photo view and the UIToolbar)