I need to display large content in my UIViewController
added in Storyboard so I added UIScrollView
with constraints top, right, bottom, left:0 ( to make it full screen ).
In top of UIScrollView
I need a square image with its width as device screen size, so I added UIImageView
with constraints : aspect ratio->1:1, top:0, centre align in container, height : 100.
And below It there is a UILabel
where I want to show large text. I am using Auto Layout.
- Is there an option to do this in Storyboard ?
- In swift I tried below
Connected Image in controller file as :
@IBOutlet weak var eventThumb: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
// set image path from url ,it works
eventThumb.image = UIImage(data: NSData(contentsOfURL: NSURL(string: self.event!.image)!)!)
let screenSize: CGRect = UIScreen.mainScreen().bounds
eventThumb.frame = CGRectMake( 0, 0, screenSize.width, screenSize.width)
}
I tried related answers given here ,here and here but they not seem to working in my case.
I am new in swift and ios, am I doing something wrong in structure ?
Edit : Image added