Xcode - Swift arrange images in a grid 2x4 [closed] - ios

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am developing a universal iOS app. I am looking to achieve the below grid layout using 8 images (inclusive of the text).
My skills of autolayout are poor, especially for universal apps. I would like the layout to remain for iPad and smaller screen devices, and scale the images accordingly.
I am unsure how to achieve this. Could you suggest a method and perhaps point me in the right direction by providing suggestions on methods to achieve this, such as UICollectionView or grid layout using autolayout.

Collection view! It's a great way to arrange things in a view like this that automatically adapts to screen size.
Apple docs - https://developer.apple.com/library/ios/documentation/UIKit/Reference/UICollectionView_class/
Simple example you can follow - How to make a simple collection view with Swift
UICollectionView is a powerful tool, can be tricky to nail down at first but follow along on the tutorial and you should be able to make your design in no time!

Related

Should I use UITableView or UICollectionView when building a chat app? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to build a chat app like the native Messages app/Whatsapp.
The design is a little bit different than the native chat bubbles (rectangle messages view instead of bubbles) but I guess the basics are the same. Of course the messages should start from the bottom of the screen like any chat app, and in the bottom there should be a "new message" textField.
Should I use UITableView or UICollectionView for this purpose?
Thank you!
I just finished shipping a chat app and went through this exact question when building the architecture. This isn't a hot take.
I made the mistake at first to go with UITableView only to realize halfway that UICollectionView is way more powerful. (UICollectionView even has a tableLayout if you want to use it this way).
I realized this after studying the other chat libraries available like JSQMessagesViewController, MMTextureChat, MessageKit etc.
UITableView is good but soon enough you'll run into performance and customization issues like I did.
As for showing the messages from the bottom, the trick is to flip the view. That way when you call insert(atIndexPath:) the item shows up at the bottom.
Hope it helps.

Stacks and Auto-layout across iOS devices [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
So I'm following a set of tutorials and have come to a point where I have the app working (A simple calculator), but the UI could still be improved.
The current UI works great on phones, but when going up to an iPad, parts of the UI expand as needed, but the buttons stay at quite a small size. I have no constraints keeping the buttons small and the stack that the buttons are in do expand to fill the space.
My project files can be found here:
https://github.com/maza256/retrocalc
An image to explain is found here:
iPhone and iPad Preview image
Any help would be great.
After looking at your project I found one change that you can make. Go to storyboard and select the buttons then click on attribues inspector. Then under control change the alingment options on the far right, which will cause your image to expand to fit the space.
Ipad
Inspector Setting
Sorry that i didn't catch this in my post. But you will need to click on the stack view for the top row of numbers and make sure to make the stack view settings like this.
Buttons are the right size. They are not small and behave as you expect. Try to change background color:
iPad screenshot
The problem is that you have very small images. You have to provide .#2x and .#3x images, so you won't lost quality on iPad.
Image assets

Using Different Screen Sizes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have an app made for a iPhone 5 screen and am having trouble making it so that it will look the same on a iPhone 4. I can't seem to figure out how to use both screen sizes without making 2 storyboards because there are about 35 views. Any answer that may help me fix this problem will be greatly appreciated.
Sincerely, Nick
~Beginner at IOS Development
Create the views more dynamic. For instance does a tableview fill up the extra space with rows. Autolayout can help increasing the distance between UIElements for this.
The old (iOS 6) way to disable iPhone 5 was not to submit the iPhone 5 Splashcreen. Afaik this "trick" isnt working anymore.
Best have a look on xcode 5. It can switch the storyboard from 4"to 3.5"on the fly and respects autolayout. Consider it as a great opportunity to get used to autolayout. (You will need it in the next gen of devices it seems)
Edit:
Make sure the top most view does resizing and this resize is passed down to your table/collectionview
If you use Autolayout then just pin the 4 borders of the collection view,
If you dont use autolayout, refer to picture 2 and make sure the autosizing behaves the same. Either way will work.

iPhone 4 and iPhone 5 compatible app - Storyboards or Autolayout? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I should create an app compatible with the screen sizes of the iPhones 4 and 5. On the web I found some ways to organize my project. The best ways to do it are to:
create two storyboards,call one when screen size is 568 and the other when screen size is 480
use autolayout and have an unique storyboard
I don't know how to use autolayout and I should learn its implementation in my project.
Then in this situation, I want to know by your experience what's the best approach.
I think that first approach is very intricate and slow, with two storyboards you can make mistakes and don't have the same situation in each device.
In my experience I used xib files, and I used two xib file for each viewcontroller, a solution which is very very noisy.
Then, what can you tell me about these approaches?
AutoLayout will make it easier to adjust your UI for both screen size, but even with the old UIViewAutoresizing you will be able to get everything working.
I would suggest that you do not use 2 storyboards or NIB for that mater, because if a some point an other screen size is introduced you need to create a third storyboard/NIBs.
You can even use the UIViewAutoresizing in NIB and in code.
Just set the autoresizing mask correct to grow/shrink with the screen size and you will be good to go.
Well , if you want to make app that run on both iOS 7 and iOS 6, than its better to use Autolayout, because it is easy to use, and also too much flexible.
Because your other options are too much complex and time consuming as well.

Pros and Cons of Auto Layout [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Yesterday, I have a problem with CGRectMake, which I already posted here: CGRectMake is not working with UIView
It is caused by having Auto Layout enabled in my project, so I have disabled it. Case closed...but today, when I run my project on the 3.5 inch simulator I have a new problem - all of my textfield, buttons, etc. seems like a mess.
Everything has no proper space between them, unlike when I had Auto Layout enabled. Here's what it looks like:
Is this the consequences of not enabling Auto Layout? If so, what should I do to make constant space between textfield, space of label to navbar, etc?
There is nothing i haven't been able to accomplish using autolayout. In my opinion if you don't use it you will go crazy.
I think the root of your problem is that in the question that suggested you disable autolayout it could have been fixed another way: Add any view manipulating code (resizing, etc) in viewDidLayoutSubviews in your view controller.

Resources