2011-03-30 9 views
0

안녕하세요. 저는 두 개의 뷰가있는 페이지 뷰 스크롤 뷰와 430px heigh 및 50px의 정적 뷰를 가진 애플리케이션을 만들었습니다. 내가 사용하는 경우멀티 뷰 앱의 문제점

sharedlibrary apply-load-rules all kill Current language: auto; currently objective-c quit Program ended with exit code: 0 

또는

2011-03-30 08:51:28.427 PhotoScroller[637:207] -[__NSCFType buttonPressed1]: unrecognized selector sent to instance 0x4b36db0 
2011-03-30 08:51:28.456 PhotoScroller[637:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFType buttonPressed1]: unrecognized selector sent to instance 0x4b36db0' 
*** Call stack at first throw: 
(
    0 CoreFoundation      0x00f2f5a9 __exceptionPreprocess + 185 
    1 libobjc.A.dylib      0x01083313 objc_exception_throw + 44 
    2 CoreFoundation      0x00f310bb -[NSObject(NSObject) doesNotRecognizeSelector:] + 187 
    3 CoreFoundation      0x00ea0966 ___forwarding___ + 966 
    4 CoreFoundation      0x00ea0522 _CF_forwarding_prep_0 + 50 
    5 UIKit        0x002bc4fd -[UIApplication sendAction:to:from:forEvent:] + 119 
    6 UIKit        0x0034c799 -[UIControl sendAction:to:forEvent:] + 67 
    7 UIKit        0x0034ec2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527 
    8 UIKit        0x0034d7d8 -[UIControl touchesEnded:withEvent:] + 458 
    9 UIKit        0x002e0ded -[UIWindow _sendTouchesForEvent:] + 567 
    10 UIKit        0x002c1c37 -[UIApplication sendEvent:] + 447 
    11 UIKit        0x002c6f2e _UIApplicationHandleEvent + 7576 
    12 GraphicsServices     0x01887992 PurpleEventCallback + 1550 
    13 CoreFoundation      0x00f10944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52 
    14 CoreFoundation      0x00e70cf7 __CFRunLoopDoSource1 + 215 
    15 CoreFoundation      0x00e6df83 __CFRunLoopRun + 979 
    16 CoreFoundation      0x00e6d840 CFRunLoopRunSpecific + 208 
    17 CoreFoundation      0x00e6d761 CFRunLoopRunInMode + 97 
    18 GraphicsServices     0x018861c4 GSEventRunModal + 217 
    19 GraphicsServices     0x01886289 GSEventRun + 115 
    20 UIKit        0x002cac93 UIApplicationMain + 1160 
    21 PhotoScroller      0x00001c20 main + 102 
    22 PhotoScroller      0x00001bb1 start + 53 
    23 ???         0x00000001 0x0 + 1 
) 
terminate called after throwing an instance of 'NSException' 

만 : 내 문제는 내가 정적보기에서 정보 버튼을 가지고 있고 내가 그것을 클릭하면 프로그램이이 때문에 폭포 하드 조금 이해하는 것입니다 페이징 스크롤 뷰에서 같은 코드는 완벽하게 작동 내 코드의

부품 : 나는 거라고

UIButton *iButton = [UIButton buttonWithType:UIButtonTypeInfoLight]; 
iButton.frame = CGRectMake(269.0f, 17.0f, 18.0f, 19.0f); 
iButton.backgroundColor = [UIColor clearColor]; 
[iButton addTarget:self action:@selector(buttonPressed) 
forControlEvents:UIControlEventTouchUpInside];  
[self.view addSubview:iButton]; 

-(void)buttonPressed{ 
    NSLog(@"button pressed in PSV..."); 
} 

그것을 이해하지 못한다면, 나는 그것이 효과가있을 것이라고 기대한다. 나는 단지 그것이 효과가없는 이유를 이해하기를 원한다.

정적보기 ViewController 페이징 스크롤 뷰의 서브 클래스가 모든 해답에 대한 UIScrollView <UIScrollViewDelegate>

감사의 서브 클래스입니다.

+0

개로 변경하여 선택기 사양을 다음과 같이 변경하십시오. ??? buttonPressed1 또는 buttonPressed를 사용하는 선택기는 무엇입니까 ??? – makboney

+0

페이징 스크롤보기에서 나는 고정 뷰에서 buttonPressed를 사용합니다. buttonPressed1을 사용하고 버튼 변수의 이름도 iButton1입니다. – Csabi

+0

변수 이름과 선택기 이름을 변경하여 시도 했습니까 ??? – makboney

답변

1

단추의 동작에 대해 지정한 선택기는 id 형식의 단일 인수를 사용해야합니다. 선택기 사양을

- (void)buttonPressed:(id)sender { ... } 
+0

100 % 이해할 수 있지만 귀하의 답변을 이해합니다. – Csabi

+0

addTarget 호출을 다음과 같이 변경해보십시오 : 위에서 설명한대로 하나의 인수를 buttonPressed 메서드에 전달합니다. ButtonController는 다음과 같은 메서드를 호출합니다. 희망적으로 도움이 될 것입니다! – Laura