How to change the width of UIActionSheet in iPad? - iphone

I want to change the width of UIActionSheet in iPad, and I tried to set a new frame size for the UIActionSheet, but nothing changed.
Any idea ?
Thanks.

I believe that is not accomplished with the built in onw, you need to create your own custom view.
Create your own custom view with all 10 buttons placed just as you liked.
Use a table view to present the options. Since the table view can be scrolled you can get the size you like.
Reference: adjusting the size of a UIActionSheet

Related

Auto position sibling UIViews

I have 4 UIViews stacked in a UIScrollView.
When any one of the UIViews are tapped, I want that particular view to expand and show some more content and this would mean the sibling views below the selected view has to push themselves down.
I could have used UITableView but there are all kinds of weird stuff happening when you change the row heights dynamically which is why I chose this fallback.
Can I use autoresizingmask to do this ?
Cheers
Your question Answer is not so simple,you Need to use Different Logic Means You know how Much Width and Hight your Each view have after Clicking on it and then you can pass the reference of View to setContentSize of Scrollview.here is some tutorial which solved my problem when i was putting some run time data in Scrollview.
link
link
Hope it will be helpfull for you.

iphone popup custom size in IB

In my application I need show some info popup. This is just a text message above an image. When I create UIView for my popup in IB, it's size is non-ediatable (and equals to 320x460).
But my popup is not full-screen size.
Of course, I can create this popup programmatically, but I'd prefer data-driven approach.
So, the question is: how do I create custom-size UIView in IB?
If you set status bar of the view to none then you should be able to resize the view.
When a view is at the root level in an interface builder document it will always appear to be 320x460 but the size isn't actually set. Interface builder is just simulating what it will look like when it's actually loaded.
If this Popup view is actually supposed to appear in another existing view then drag it inside that view in IB. Once it's no longer at the root level you will be able to set its size.

iPhone - adjusting the size of a UIActionSheet

I need to present a UIActionSheet that will show 10 buttons. When I do that on iPad, the UIActionSheet shows on a popover that is very long vertically (not aesthetically pretty). Is that possible to specify the UIActionSheet size to a maximum size?
I have tried this
myActionSheet.frame = CGRectMake(0,0,300,300);
myActionSheet.bounds = CGRectMake(0,0,300,300);
and have also tried to put these lines inside
- (void)willPresentActionSheet:(UIActionSheet *)actionSheet {
without success.
any clues?
thanks
I think this is one of the cases where you can't really use a built-in class like the UIActionSheet to accomplish your goal. I don't think it is designed to be used for cases where you have as many buttons as 10. It just doesn't scale very well, just as you have discovered.
But let's pretend that it would be possible to change the size. What should happen when you change the size? There is a minimum size for each button for it to be tapable. And you also need some space between the buttons as to not cause a misstap. So even if you could change the size it couldn't be reduced by very much. And since it's not intended to be able to change the size you would have to try and access all the buttons and resize and move them as well. One could argue that perhaps the buttons could be placed in columns but since that is not implemented it would still not help if you made the UIActionSheet any wider.
I would recommend that you either:
Create your own custom view with all 10 buttons placed just as you liked.
Use a table view to present the options. Since the table view can be scrolled you can get the size you like.
If you set modalInPopover to YES on the UIViewController you present in the popover the user must make a choice before she can move on.
try with `- (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated
because in apple documentation they said:
"On iPad, this method displays the action sheet in a popover whose arrow points to the specified rectangle of the view. The popover does not overlap the specified rectangle."
`

UITableView with dynamically set size

I have a UITableView as a subview in a ScrollView with other widgets around like a button. I'd like to put the button always at the end of the ScrollView and I'd like to have the UITableView to show dynamically more section. How and where shall I determine the Table size, correctly set it and visualize it?
From Interface Builder it seems that I can only set static size to the TableView (which of course limits the number of sections visible) and stick the button position to the bottom whether a rotation happens.
If you have only few simple controls after the table then I'd suggest putting them to the table itself and get rid of the unhealthy (in my opinion) combination of table view inside scroll view.
You might add the button you are talking about to the table's footer.
It may be done in the Interface Builder (drag-n-drop the button to the bottom of the table view) or in the code ([tableView setTableFooterView:myButton];).
If your button should be smaller that table's width then put it inside UIView and locate as you need.
You can also add table header in a similar way...

Is it possible to access a UITableView's ScrollView In Code From A Nib?

Right now I am creating a UITableView in a FlipsideView nib. I don't seem to be able to change the background of the table view from within interface builder. I can fix this by creating an outlet and then setting the background. However, I want to give the scroll view rounded corners in order to create a look similar to the iPhone weather/stock app table views. Is there a way to access the scroll view's property in code so that I can set the rounded corners?
A UITableView doesn't have a UIScrollView, it is a UIScrollView. UITableView is a subclass of UIScrollView as can be seen it the documentation. Any properties of functionality of UIScrollView you want to access can be directly accessed via the table view.
Similarly, UITableViewDelegates are all UIScrollViewDelegates.
You can add a corner radius to any view's layer. It would look something like this:
theTableView.layer.cornerRadius = 10.0f; // Or whatever radius you wanted to set
I believe you'll need to link to the QuartzCore framework and import the QuartzCore.h header, too.
This will round the corners of the table similar to how they appear in the flipside of Weather.app.
If I'm not mistaken, the table views for the Stocks and Weather applications are simply single-section grouped table views (UITableViews initialized with the UITableViewStyleGrouped style). You shouldn't need to customize anything about the table view's UIScrollView properties to generate this same rounded-corner effect.