iPhone how i can I do multiple columns in UITableView/UIImageView - iphone

How I can implement the following screen.
What are ui controls can be used for implementation the same grid behavior?
I'm seeing UITableView, but it doesn't support multi columns. How can be?
Thanks,
Anatoly

How about a UITableViewCell with three (if you count the stars it'll make six) UIImageViews and three UILabels?

You could put three UIImageViews and three UILabels below the images per cell.
Here's a tutorial on how to draw grids in a UITableView.
But for your case I'd do it with interface builder for a custom UITableViewCell:

Basing from your requirements, I think you should use AQGridView,
I found it here: https://github.com/AlanQuatermain/AQGridView
You can download the sample code.
I've downloaded the sample code and run it on my iPad 5.0 Simulator, here is the screenshot:
and what amazed me most is that when you switch your device to landscape mode, it automatically displays the images in four columns (to utilize the space):
I hope this helps.

Customizing UITableViewCell to contain many cells inside and rendering each cell as needed.
Anyway, it's not a good practice to do that in your controller. You should build an external control to handle it.
Please take a look at my UIGridView. It uses the explained technique and produce the result that you want.
Here is the screenshot:

Related

How can I make a grid similar to iphone/ipads launcher screen?

I have seen a few grids made with UITableView but I don't really like how close together each cell is to the other. If there is a way of creating a grid system like the home screen on an iphone (the screen after it is unlocked) if would be great. I don't need an exact solution but a point in the right direction, maybe a set of libraries to look through would be great. I am running xcode 4.4.1
Thanks!
The key is UIScrollView has a paging mode (since could have more buttons than fit in the view). It's covered here's in Apple ocs:
http://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/UIScrollView_pg/ScrollViewPagingMode/ScrollViewPagingMode.html
If you use that, each 'page' would have n buttons/views that when clicked would call a protocol/delegate call back for the consumer with the data to handle and it would evenly layout the UIView/buttons across that page view. Contact me if you want my sample.
You probably don't want to require iOS6 as a minimum requirement but if you do, you can do as H2CO3 suggested in the comment and us UICollectionview. Here's a tutorial: http://www.raywenderlich.com/22324/beginning-uicollectionview-in-ios-6-part-12
There's also some open source launchers that you can look into their code. Here's some (I'm sure there's more).
http://www.cocoacontrols.com/platforms/ios/controls/sespringboard
Code is at: https://github.com/sarperdag/SESpringBoard
Also: http://www.cocoacontrols.com/platforms/ios/controls/openspringboard
Use UICollectionView. You can create grid type views using that. It is available in iOS 6.
If you can target iOS 6+, use UICollectionView. It's one of the best new things in iOS for years and it will be as important as UITableView.
The layout you're asking for is only a few lines of code.
NSHipster has a good explanation of UICollectionViews and Ray Wenderlich has a good tutorial.
(There's lots of example code out there, but here's a very simple example project I did recently for another question involving UICollectionViews)

iOS Grid View with support for different sized cells

I'm an iOS developer looking for a solution to a tricky problem.
I need to create a grid view/ mosaic view to layout cells of different sizes (both width and height).
I basically need the functionality of a GMGridView, with horizontal scrolling/paging, the ability to edit, and drag cells to new locations, thus rearranging the entire grid view. I've looked at all of the current open source grid views out there, and found none with variable sized cells.
One solution I have thought about is 2 tableviews both rotated for the horizontal scrolling, and then intercept some UITableView scrolling methods, to then scroll the other tableview together. This is not ideal, as I will be unable to move a cell from one view to another, and I'm not sure how happy apple will be about it.
I also know of some possible (confidential?) support for this coming in the next version of iOS, but would like to keep my app supporting previous versions of iOS.
Thanks for any insight you can provide.
I realize this post is kind of old, but here is a list of relevant projects: *https://github.com/betzerra/MosaicUI
*https://github.com/betzerra/MosaicLayout
GridViews on iOS are a pain. Fortunately Apple is coming up with UICollectionViews that are optimized to build grids. This is coming in iOS6 and it's still under NDA so check out the documentation on Apple's website for more information.
The question you need to solve now is whether you want iOS5 retro-compatibility or not

Questions about recreating the "Add Alarm" form in the iOS Clock app

(source: kominetz.com)
Hello. I'm diving into iOS development and am building my own alarm app to become familiar with the SDK. My questions are...
I've played around with UITableViews a bit, but I don't understand how I would implement the table at the top half of this form. If I had to guess, I would say it's a single UITableView, defined with one section and four rows, is that right?
If so, to implement it, would I just "hardcode" the cellForRowAtIndexPath function to create each cell manually?
If not, is there an adopted approach to defining the layout and functionality of these types of settings pages?
Row #3 has a switch in it, is this a predefined cell style or a custom cell style that I have to define myself?
Rows #1, 2, and 4 take the user to new views when they're touched. Is this a predefined style and or do I just implement the standard didSelectRowAtIndexPath functionality to push a new view onto the stack?
Thanks so much in advance for your help! I'm going to continue researching these questions right now.
In answer to your questions:
Yes
Yes
n/a
No, you have to add a UISwitch to the cell's contentView. Tip: Look at Apple's UICatalog sample code (controls sections) to see how to implement a tableview with different controls in different rows.
Just use didSelectRow...
For most apps, you want to implement the Application Preferences settings plist that will be used by the device's Settings application. It's typically a good idea to keep the settings for your app consistent with how the settings work in other apps.

How to implement a large grid of cells in an iPhone application?

In reference to my previous question, I would like to know how to implement a large grid of cells in an iPhone application.
I'm working on an interface which would be similar to an Excel spreadsheet, with many rows and columns. Do I have to handle each cell separately? How can I handle user interaction in each cell?
Is there a standard way to create this type of control?
There is no real standard mechanism.
If all of the cells in a given row will always fit in the width of the screen, one way to do it would be to create a UITableViewCell with several UILabels and vertical separators between them. If all of these rows had "columns" of the same width, you would get the appearance of a grid.
If that isn't possible, it might be helpful to think about what the table view control truly is. A table view is just a scroll view that automatically adds, removes, and recycles its subviews so that only the ones that are visible at a given time are in memory. There is no reason you could not write a GridView control that did the same thing, but in two dimensions. It wouldn't be as easy as using the built-in table view, of course, but if the table view can't do what you need, well, that's why Apple isn't writing all the apps.
Sounds like the exact thing that UICollectionView was made for!
http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UICollectionView_class/Reference/Reference.html
Look at my answer to this question: MS Excel type spreadsheet creation using objective-c for iOS app.
Basically there's no standard way to do this. You will need to made everything by hand and there's 3 ways to go:
Use a UIWebView and layout everything using html/js.
Modify a UICollectionView.
Make everything by hand using Core Data.

Generate View for iPhone application using interface builder.?

I wanted to generate one fix view using interface builder, but the size of that view is exceeding the size of iphone screen,and I am not able to maximize screen. I wanted to show table view in that screen.
I did enabled scrolling but that didn't work,
Update 1:
Actually I wanted to show thumbnail image inside cell and i want to show 5 cell so 5 thumbnail image,those images are static. So which is a better way to achieve this ,interface builder or programming?
Hope this is clear enough.
Your question is not terribly clear, so this is the question that I am attempting to answer here:
You want to have a table view which has five rows, each of which has a small image.
Short answer: you can't do this entirely in the Interface Builder. What you can do is define your table view, including the "look," scrolling abilities, etc. And then in the same XIB file you would define the table cells (which can include your pictures, captions and what have you).
You then have to connect the two together programatically. Apple provide plenty of examples in the SDK on how to do this.