亚洲激情专区-91九色丨porny丨老师-久久久久久久女国产乱让韩-国产精品午夜小视频观看

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

IPhone開發文檔經典語句

發布時間:2020-07-27 02:18:31 來源:網絡 閱讀:354 作者:NetworkAD 欄目:開發技術

1:When a touch occurs inside a specific view, the system sends an event object with the touch information directly to that view for handling. However, if the view does not handle a particular touch event, it can pass the event object along to its superview. If the superview does not handle the event, it passes the event object to its superview, and so on up the responder chain


測試:

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIView * view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
    view.backgroundColor = [UIColor blueColor];
    
    UITapGestureRecognizer * tapGesture = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewClick:)];
    
    [view addGestureRecognizer:tapGesture];
    
    UIView * view2 = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
    view2.center = CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height/2.0);
    view2.backgroundColor = [UIColor blackColor];
    [self.view addSubview:view];
    
    
    UIButton * button = [[UIButton alloc]initWithFrame:CGRectMake(0, 0, 60, 50)];
    button.backgroundColor = [UIColor redColor];
    [button addTarget:self action:@selector(buttonClick) forControlEvents:UIControlEventTouchUpInside];
    button.center = CGPointMake(self.view.frame.size.width/2.0, self.view.frame.size.height/2.0);
    [view addSubview:button];
    [view addSubview:view2];
}

- (void)buttonClick
{
    NSLog(@"buttonClick");
}

- (void)viewClick:(UITapGestureRecognizer *)tap
{
    int red =arc4random()%255;
    int green = arc4random()%255;
    int blue = arc4random()%255;
    NSLog(@"%d %d %d",red,green,blue);
    tap.view.backgroundColor = [UIColor colorWithRed:red/255.0 green:green/255.0 blue:blue/255.0 alpha:1];
}

測試發現在view2上發生點擊事件,由于view2并不響應該事件,于是將事件傳遞給它的父視圖,顏色發生改變,但是該點擊事件并不會通過view2傳遞給button,所以事件傳遞,僅傳遞給它的父視圖,也就是[superview addsubview:subview]中得superview



向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

精河县| 黎平县| 砀山县| 台湾省| 聊城市| 神农架林区| 宜兰县| 陇川县| 江津市| 银川市| 通城县| 松滋市| 安平县| 镇坪县| 宁化县| 繁峙县| 泸西县| 永丰县| 太白县| 漯河市| 岚皋县| 肥西县| 麦盖提县| 新田县| 广河县| 宜阳县| 泾川县| 依兰县| 黎川县| 洞口县| 江陵县| 黔西| 桓仁| 休宁县| 淳化县| 大方县| 商南县| 阿拉善左旗| 沂源县| 车致| 茂名市|