0

source code:

protocol UIImageExtension{

    init?(normalImage: NSInteger, pressedImage: String, textTag: NSInteger)

}


extension UIImageView: UIImageExtension{

    required convenience init?(normalImage: NSInteger, pressedImage: String, textTag: NSInteger)

    {

        self.init(frame: CGRectZero)

    }

}

I want to add a init methods like above, But it always not right, Anyone can review source code and help me right from wrong? thank you very much

Will Wang
  • 3
  • 2
  • 1
    Why don't you just extend UIImageView itself, without implementing any protocols? Just adding a new convenience init function should work. Don't forget to add a self.init(..) in your convenience init so it can compile. – Yeehaw Jan 11 '16 at 10:07
  • "But it always not right" : What do you mean? What is not right? – 0x416e746f6e Jan 11 '16 at 12:13

0 Answers0