I'm making an app that shows the weather information.
I have the view divided into 3 sections:
1- A Uiview with information about today's weather
2- A UITableView with the following days of the time
3- A horizontal table with time by hours for today (Here the problem)
I used the ASHorizontalScrollView
library but all the items are horizontal.
Let me explain: What I want is for a small icon to appear with the time and temperature, for each hour. The problem is that I do not have one under another, but everything horizontally.
All the items should go out horizontally, but within each item, the 3 items, one below the other.
Do you know any bookstore or code to work more or less as I explained?
Here is an example of the code:
let horizontalScrollView:ASHorizontalScrollView = ASHorizontalScrollView(frame:CGRectMake(0, 0, vistaScroll.frame.size.width-12, 50.0))
horizontalScrollView.leftMarginPx = 0
horizontalScrollView.miniMarginPxBetweenItems = 0
horizontalScrollView.miniAppearPxOfLastItem = 0
horizontalScrollView.uniformItemSize = CGSizeMake(50, 50)
//this must be called after changing any size or margin property of this class to get acurrate margin
horizontalScrollView.setItemsMarginOnce()
var valorArray = "01"
for index in 1...24 {
if index < 10 {
valorArray = "0" + String(index)
}
else {
valorArray = String(index)
}
let estado = currentArticleToDisplay.estadoCielo[valorArray]
let label = UILabel()
let labelHora = UILabel()
let img = UIImageView()
let url:NSURL? = NSURL(string:currentArticleToDisplay.icono[estado!]!)
let imageRequest = NSURLRequest(URL: url!)
// Fire off the request to download it
NSURLConnection.sendAsynchronousRequest(imageRequest, queue: NSOperationQueue.mainQueue(), completionHandler: {(response, data, error) in
// Assign the data to the imageview
img.image = UIImage(data: data!)
})
label.text = currentArticleToDisplay.temperatura[valorArray]
labelHora.text = valorArray
let vista = UIView()
vista.frame = CGRectMake(0, 0, 100, 50.0)
vista.addSubview(label)
vista.addSubview(labelHora)
vista.addSubview(img)
horizontalScrollView.addItem(img)
horizontalScrollView.addItem(label)
horizontalScrollView.addItem(labelHora)
}
vistaScroll.addSubview(horizontalScrollView)
Currently it's like this:
What is inside the blue circle would be an item. what I want is that instead of leaving the sun, the temperature and the time in line, leave one under another one
Thanks in advance!