UISegmentedControl in UIToolbar - objective-c

I'm migrating an App from iOS 4 to iOS 5 and I find myself stuck. Here's my problem:
I have a UIToolbar that has a UISegmentedControl within. Now, with the old App, I used all the methods of UISegmentedControl, like
[switch removeAllSegments];
but this leads to crash in the new iOS 5 because now the UISegmentedControl is automatically converted in UIBarButtonItem.
How can I solve this situation?

This may not best practice. But i think you have to add subview on UIToolbar and in that subview please add segmented controls. May it work for you.

Related

Show UIImageView in front of UIView

Is there a way to show a UIImageView in front of a UIView (for Preview live)?
I try to make a camera based application so when clicking on a button the app take a pic and show it into UIImageView.
[myView addSubview: myImageView]
should work fine. if not please post your code.
If you are adding the view programmatically the previous suggestion should do it. If the views are in a storyboard or XIB and you want to move it to the front, try this:
[self.view bringSubViewToFront:myImageView];
You might want to use UIKit Peek and Pop if you are on iOS 9 or above.
Also there is this tutorial: http://useyourloaf.com/blog/3d-touch-peek-and-pop/

How do you create a UIActionSheet with another View above it?

In objective-c, is it possible to create a UIActionSheet with buttons towards the bottom and a View object at the top, with an ImageView and a Label objects inside the View object? If so, any insight to approaching it would be helpful.
UIActionSheet has been deprecated in iOS 8.3. And as your description, UIActionSheet also cannot do what you want.
A recommendation is to create a ViewController and add what you want into this.
Use a modal presentation style of UIModalPresentationPopover and UIPopoverPresentationController to show this ViewController.
Note, UIPopoverController can achieve your requirement, but is has been deprecated in iOS 9.0

Layered viewcontroller for iPad

I would like to implement a layered viewcontroller control, where pushed viewcontroller doesn't cover the entire screen but will leave say 20pixela width on the left. If 5 viewcontrollers are pushed and I'm tapping on viewcontroller 2, it should expand, but not remove viewcontroller 3,4 and 5. Only slide them to the right.
The idea comes from the iPad app Trivago and I don't know if they're using an open framework. If not, do you guys have a good idea for implementation? The structure/architecture is fine :-)
If I can create a nice control I will make it public as a cocoapod :-)
Thanks!
Sounds like you may want to do View Controller Containment instead of using a UINavigationController.
See: Creating Custom Container View Controllers
Update:
More examples:
WWDC 2011: Implementing UIViewController Containment
iOS Programming Recipe 28: View Controller Containment & Transitioning

UIViewController's UIView autoresizing subviews not checked after restart of Xcode 4.6.1

I have a UIViewController in an iPad storyboard (no autolayout).
For the UIView of that UIViewController, I checked autoresize subviews. If I run that in the simulator (iOS 5 and iOS 6), the subviews don't get autoresized. Even stranger is, that if I close the project and Xcode and relaunch both, the checkbox "autoresize subviews" isn't checked anymore.
That happens just on the iPad storyboard. The storyboard for iPhone (no autolayout too) doesn't have any problems at all.
Did someone see a similar behavior or does someone know how to fix that?
Thank you very much for your help
Linard
That was a very strange bug...
I have just dragged and dropped a new UIViewController with a UIView and copied the old objects in the new UIView.
Now it works!
I hope this post will save someone in the future a lot of time
Linard

Buttons working in ios6 stopped working in ios5

I load two buttons in one view from the NIB.
I set this view as self.navigationItem.rightBarButtonItem in current viewController
I set actions for these buttons
Result:
Buttons work under ios6 - both simulator and device and not working on ios5 device.
Any idea to fix it?
I fixed it by set "Autosizing" in "Size inspector".
(in my case, the problem came from resize iPhone5 to iPhone4)
The problem is now solved. This was caused by setting UIViews objects in IB and then setting its class to UIButton. It should have no effect on buttons behaviour, but it had. The more wired was that it did work on iOS 6 and did not in iOS 5.