I have an understanding problem...
I created two similar views (same origin and same size) and section view,
While i created those views - one in viewDidLoad
and the other in viewDidAppear
- when i put similar starting point in the origin x and y of each view that refer to section i get those views in different position.
Can someone explain me what is the reason that those views isn't in the same position?
import UIKit
class ViewController: UIViewController {
@IBOutlet var sec: UIView!
override func viewDidLoad() {
let shape = UIView(frame: CGRect(x: sec.frame.width/2, y: sec.frame.height/2, width: 100, height: 100));
shape.backgroundColor = UIColor.redColor();
view.addSubview(shape);
}
override func viewDidAppear(animated: Bool) {
let shape2 = UIView(frame: CGRect(x: sec.frame.width/2, y: sec.frame.height/2, width: 100, height: 100));
shape2.backgroundColor = UIColor.greenColor();
view.addSubview(shape2);
}
}