ios - Difference between frame.size.width and frame.width -
i writing program in swift , noticed can directly access cgrect frame's width , height properties directly without using cgsize width , height. able write code this.
@iboutlet var myview: uiview! override func viewdidload() { super.viewdidload() var height = myview.frame.height var height1 = myview.frame.size.height } in objective c, when tried write same code, line height = view.frame.height throwing error. can please tell me difference(if any) in these 2 lines of code.
i looked cgrect structure reference. in swift there extension defined have members height , width. please have @ code below
struct cgrect { var origin: cgpoint var size: cgsize } extension cgrect { ... var width: cgfloat { } var height: cgfloat { } ... } so can directly fetch height , width values cgrect. can see these getters, error if try set these values using view.frame.height = somevalue
Comments
Post a Comment