我忙於一個需要觸摸按鈕的應用程序,但是當你在按鈕外(在應用程序屏幕的背景上)觸摸時,我想顯示警報。檢測背景水龍頭
有誰知道如何檢測在背景中的龍頭
按鈕:
MyButton = [UIButton buttonWithType:UIButtonTypeCustom];
MyButton.frame = CGRectMake(0, 0, 100, 100);
[MyButton setImage:[UIImage imageNamed:@"tap.png"] forState:nil];
[self.view addSubview:MyButton];
[MyButton addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside];
在backgroundtapped我置於的NSLog和當我觸摸我的按鈕警報(nslog)顯示了..我觸摸了按鈕,而不是背景? – Frenck 2012-03-16 23:30:11
嗯,我很想知道,雖然我有點驚訝,因爲我以前做過類似的事情,它的工作。我需要有一個想法,並建立一個測試... – mattjgalloway 2012-03-16 23:49:18
uibutton編程腳本。沒有界面生成器。在HTML中,你可以使用z-index的東西,這在objective-c中也是可行的嗎? – Frenck 2012-03-17 11:01:57