iPad SplitView TableViewController width - uitableview

How do you change the width of the UITableViewController in an iPad SDK 3.2. It seems that it is fixed just like the iPhone UITableView.

I got your requirement what do you want to do in you application. Here you can carry out it in different way.
Instead of using UITableViewController, please use UIViewController and then add UITableView inside the UIViewController. Here you can change the frame size of UIView as you want. But you can't change the frame size of UIViewController as it is the base view and it will be the same as iPad screen. Please do like this and let me know if you have any questions or doubts.

Related

UICollectionView bigger than NavigationController

I have a UICollectionView embedded in a NavigationController which in turn is embedded in a ContainerView.
The NavigationController views frame width is correctly 964, but the UICollectionView frame width is still 1024.
I cant set any constraints, I thought it would fill to fit the nav controller, not be larger.
What am I missing?
UPDATE: I am using a UICollectionViewController and I am not using any code for this functionality, all done through the storyboard.
Ok, so I considered vacawamas question of whether it's a uicollectionviewcontroller or a uicollectionview. It prompted me to try the uicollectionview which then allowed me to directly apply constraints and it worked!
I still have no idea why the uicollectionviewcontroller didn't work but I'm learning developing iOS apps seems to involve using a lot of workarounds :(

How to show Collection in iPad but List in iPhone?

I have a requirement to show the Data in Linear Vertical List in iPhone and
in Collection/Grid in IPAD
In the iPhone, it should look like
But In Ipad, it should look like
I have already implemented in iPhone through table view but don't know how to show it as grid view in IPAD
Here are my questions
should I have to create the Separate view controller for Ipad if yes
then how can I define two view controller one for iPhone and other
for iPad
what is the best way to achieve this?
please help me I am trying to implement it but can not find any way.
(Note)Images are copied from Vimeo iTunes app https://itunes.apple.com/us/app/vimeo/id425194759?mt=8
You don't need to create two different controller's for IPAD and IPHONE. Just create one controller with UICollectionView and then use UICollectionViewFlowLayout for your UICollectionView to set layout of UICollectionView according to the device weather it is IPAD or IPHONE Try this solution if you have any doubt pls let us know.
Try this solution
UICollectionViewFlowLayout *collectionViewFlowLayout = [[UICollectionViewFlowLayout alloc] init];
[collectionViewFlowLayout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
self.myCollectionView.collectionViewLayout = collectionViewFlowLayout;
Also you can use multiple properties of UICollectionViewFlowLayout.
Check this solution and let me know if it works for you.
Check these links for reference :
https://www.raywenderlich.com/136159/uicollectionview-tutorial-getting-started
https://www.raywenderlich.com/107439/uicollectionview-custom-layout-tutorial-pinterest
The way to do this is with Adaptive Layout and size classes in the storyboard. You don’t need to write any code at all, and you are also covered for multitasking/split-screen and future iOS devices of unknown dimensions. You can make any view appear or disappear according to weather the width is compact (like the iPhone) or regular (like the iPad). In the views inspector you can add a variation for compact width like this:
Adding a compact width variation to view
Click add variation and untick “installed”. Now that view will only be installed when the device has compact width. You can do this with a container view with an embed segue to a UITableViewController.
If you view the storyboard as an iPad ( by clicking the little icons at the bottom where it says “view as”) that view will disappear. Replace with another container view that segues to UICollectionViewController and do the same again, but this time add a variation with regular width.
Thats it.
(Sorry, I don't have enough points to show images)
Here is a Demo project that creates something like the layout and behaviour you want. All the action is in the storyboard, the view controllers are just skeletons.

UICollectionViewCell content invisible on iPad

I've got an universal iOS app which can run on iPhone or iPad.
On iPad I can't see the content of the UICollectionViewCell, but I'm able to see them if I add a background color to them.
Here is the code : https://github.com/rvi/collectionViewTest
Screenshot on iPad :
Screenshot on iPhone :
What am I missing ?
You have to set the delegate of the collection view to get the collectionView delegate methods called. And also add the collectionView to the view of the view controller. I can't see those things on the ViewController.swift file.
You can set up the cell in wAny|hAny size class, and you will see it on iPad. Right now the cell in size class for iPad is grayed out. Another way is to add switch and button for size class wRegular | hAny.
The solution was close to the one proposed by gabbler, is to select wAny|hAny size class on the subviews (button and switch), like this :

ScrollView height for 3.5" vs 4" iPhone

I have a UITableView in a UIViewController which is inside a UINavigationController which is inside a UITabBarController.
When Developing using a 3.5" Simulator and having my storyboard set to 3.5" and everything works fine.
However if I use a 4" simulator, the UITableView ends too short up the screen. And if I do it the other way around the table view ends off the bottom of the screen.
How do I go about correctly sizing my UITableView?
(P.S. I'm not sure it matters, but I'm loading an AdBannerView which goes at the bottom of the screen, so I'm adjusting the contentInset of the UITableView after it is loaded to make space for the AdBannerView, but I don't think that makes a difference to this situation).
You need to add auto layout constraints so that the components are resized according to the desired logic.
Read Apple's Auto Layout Guide and you'll know everything you need in order to accomplish this.

Scroll View is not scrolling

I have designed my app for 4inch devices using xcode 5 and storyboard builder. Since the 3.5inch screen is a little bit smaller, I want to make my view scrollable.
This is what I have done: I added a ScrollView using interface builder and added my View (that contains all elements) as a subview of it.
I start the app using the 4inch simulator and it does not scroll - exactly what I want. But when I open it with the 3.5inch simulator my content gets cut and scrolling is not possible. Why? And how can I activate it?
have you implement the UIScrollViewDelegate Protocol
Do you use Autolayout?
You also want to make sure your scrollview's contentSize is set to your view's size.

Resources