Swift: How to add new property to UIImageView class? -


i'm afraid i'm relatively new swift, have looked around best , haven't been able figure out how relatively simple task!

i add new property called "angle" class uiimageview, such use "image.angle". here's i've got, having attempted follow method of tutorial used (note required init? part suggested xcode , not sure of does):

class selection_image: uiimageview {      var angle = double()      init(angle: double) {         self.angle = angle     }      required init?(coder adecoder: nscoder) {         fatalerror("init(coder:) has not been implemented")     } } 

thank help!!

class selection_image: uiimageview {      var angle = double()      // new init   required convenience  init(angle: double) {         self.init(frame: cgrect.zero)          self.angle = angle     }      override init(frame: cgrect) {         super.init(frame: cgrect.zero)     }     required init?(coder adecoder: nscoder) {         fatalerror("init(coder:) has not been implemented")     } } 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -