I have some Class extended from base class (MSC_CLItem
) like this:
class MSC_CLItem
{
var Type:MSC_CustomListType!
func RenderUI(Point:CGPoint) -> UIView
{
return UIView(frame: CGRect.zero)
}
}
Each extended class must to override RenderUI func
to generate itself. All of the extended objects will be added in UIScrollView. Now my problem is:
An uiimageview with TapGesture inside of custom view not detect action. For example my class is:
class MSC_CLItem_Tizer : MSC_CLItem
{
var Title:String!
var Video:MSC_CLItem_TizerVideo!
var Detail:MSC_CLItem_TizerDetail!
private init(title:String!)
{
super.init()
self.Title = title
super.Type = .Tizer
}
override func RenderUI(Point:CGPoint) -> UIView
{
let v = UIImageView()
v.backgroundColor = UIColor.yellowColor()
let screenSize: CGRect = UIScreen.mainScreen().bounds
v.frame.size = CGSize(width: screenSize.width - 10, height: CGFloat(160))
v.frame.origin = Point
let vid = UIImageView()
vid.image = UIImage(named: "default")
vid.backgroundColor = UIColor.grayColor()
vid.contentMode = .ScaleAspectFill
vid.af_setImageWithURL(NSURL(string: "Image HTTP url")!)
vid.frame.size = v.frame.size
vid.frame.origin = CGPoint(x: 0, y: 0)
vid.clipsToBounds = true
vid.userInteractionEnabled = true
v.userInteractionEnabled = true
let tapRecognizer = UITapGestureRecognizer(target: self, action: Selector("imageTapped:"))
vid.addGestureRecognizer(tapRecognizer)
v.addSubview(vid)
}
func imageTapped(gestureRecognizer: UITapGestureRecognizer) {
//Not detected to here
}
}
And when I tap on image the following error occurred:
NSForwarding: warning: object 0x7c8cc830 of class 'MSC_CLItem_Tizer' does not implement methodSignatureForSelector: -- trouble ahead Unrecognized selector -[MSC_CLItem_Tizer imageTapped:]
I'm very confused of which section of my code is wrong?
Thank you