I am building an Iphone app.
I need to display a settings Menu to the user when a button is clicked. The menu will NOT be covering the whole screen and there is a specific location I want it to appear. How should I do that?
I understand how to set the hidden property of a subview to give the illusion that the subview is not onScreen. However, I need a view controller for this subview ( meaning .m and .h files as well). So How can I add this subview programmatically at a specific location.
Thank you very much
What you are describing is very much the behavior of a UIPopoverController. Unfortunately, that is only available for use on iPad's and not iPhone's or iPod Touches. So if you want to develop this you will need to develop this from scratch.
It's not a UI pattern you see much on the iPhone due to the screen size, but I imagine you will need to build up a custom UIView and add it the main window view with a specific size (smaller than screen size) and with the view's frame.origin set to a value other than (0,0).
Just make sure that what you are trying to achieve falls within Apple's Human Interface Guidelines.
[myView addSubview:myViewController.view];
myViewController.view.frame=...
Related
I am working on an app for iOS and I have to do a tab selection screen like the Google Chrome app for iPhone (I attached a screenshot). I searched a lot but I didn't found any similar control to use. As i can see, it groups some UIViews and use a UIScrollView to scroll, but maybe any of you could explain me better how this control works or have any solution.
Thank you!
http://i.stack.imgur.com/rCG5g.png
Create Different UIViews with your controls.(One tab is equal to is on UIView)
Add this UIView's on UIScroll View.(This is optional. It's ok if you don't use the UIScrollView and add UIView on self.view
Implement the touch method on UIView.
When you get a particular UIView is touched change it's center position to Center of the screen.
Which will give you the UIView which is touched in foreground and rest of the Views in background.
Hope this will help you .........
I solved my problem with this ......
https://github.com/xxhp/BrowserTabViewDemo
I want to implement the side swiping gesture to go from one objet to another. Just trying to figure out what its called so I can start looking up some tutorials.
Add your view controllers to UIScrollView and set the pagingEnabled property of the scroll view to YES.
The small dots displyed at the bottom of the iPhone's home screen is UIPageControl. You need to configure it to fit your needs.
You can use a UIScrollView to implement paging.
I'm quite new to iPhone development, and now dealing with a remote control app. Currently I can receive desktop image and perform simple mouse operations. But I still want to show a mouse pointer on my iPhone screen.
The desktop (very big, 1280X800) is in a image view which is the subview of a scroll view. Is there any way I can add a pointer image on top of the desktop image, and set it to any place I want? The pointer image do not receive any user interaction, it would be just floating on the desktop image.
Thank you very much for help.
Yes, just create a new UIImageView (or any other UIView subclass) with a frame based on where you want it to appear and add it to the scroll view's view using the addSubview: method. By default subviews you add later will appear above subviews you add earlier, but you can explicitly control which view appears on 'top' using 'bringSubviewToFront:'.
This should be simple.
I'm making a very basic app, based on the Utility Application template of XCode.
On the flipside, I have more content than fits the screen.
The flipside is a UIView. I think it should be a UIScrollView, but somehow I don't get it to work.
Can anybody here advise me on this?
With a UIScrollView it is not enough just to place the control into Interface Builder and place the items within it; you have to set its content size in code.
Therefore in the -viewWillAppear method (or similar) you should have something like:
[scrollView setContentSize:CGSizeMake(320, 600];
This would make the content size inside the scroll view 600 pixels high (ie larger than the height of your iPhone display). If everything else is wired up correctly, this shoud now work.
Note: You may also then need to reposition your objects within the view. Set frame.origin for the objects that require this...
I have a view that supports landscape and portrait viewing, with the controls all moving around when you switch from one to the other. I'm currently doing this by setting the .center of each one of my controls when the user rotates the phone. The problem is that this is tedious, and requires a lot of code, and seems to defeat the purpose of using Interface Builder in the first place.
My question is: is there a way in Interface Builder for one view to support multiple looks (one for landscape one for portrait)? If not how do other people do this with IB? Do you set up 2 views?
Edit: Just to clarify my landscape and portrait views look different, I don't want a straight transform, I actually display the data differently in landscape mode
When necessary, I add UIView objects to the view in IB which I make hidden. Give it a nice background color so you can see it, and send it all the way to the background. Then use that view's frame when you need to set the frame of an object. If you have a lot of them, you might consider using UILabel instead, so you can give it a visible name in IB.
If you're worried about memory issues, just remove all these extra UIViews in ViewDidLoad and just store their frame values in member CGRects. This only works of course if you don't have any of the views auto-resize or reposition on rotate, which you probably shouldn't anyway, in this case. I do this for resizing/repositioning for any reason, not just when the screen rotates.
I'm not 100% sure if it's possible, but have you considered using different view controllers for landscape and portrait?
The AutoSize attributes of IBOutlet objects in the Size Inspector of IB (command 3) give some pretty nice options for auto-stretching and positioning of items. You can control L/R and T/B screen positions and relative width and height. You can't get full control of the layout, but most of the basic operations are there.
The only way one view can support multiple orientations in IB is to set the autosizing mask of components to either scale and/or anchor to edges. To design a totally different layout for each orientation you need to design a portrait and landscape view separately (each in its own XIB) and switch between them programatically.