안녕 얘들 아! 나는이 작은 문제가 있습니다하위 뷰에서 메서드 호출
을 내가 가지고 나는 이런 식으로 뭔가 그래서 내의 ViewController에서이 개 하위 뷰를 추가 하나의 ViewController :
//in my viewController.m i have this:
- (void)startIcons
{
IconHolder *newIconHolder = [[IconHolder alloc] initWithItem:@"SomeItenName"];
[self.view addSubview:newIconHolder];
}
- (void)onPressIcon targetIcon(IconHolder *)pressedIcon
{
NSLog(@"IconPressed %@", [pressedIcon getName]);
}
을 그리고 이것은 내 서브 클래스 touchs입니다 : 이제
//And in my IconHolder.m i have this:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
//Here i need to call the method onPressIcon from my ViewController
}
: 어떻게하면됩니까? 가장 좋은 방법은 내 ViewController를 저장하기 위해 생성자에서 연결을 만드는 것입니다. 내가 어떻게해야하니?
감사합니다.