2012-07-23 3 views
0

3 일 동안이 문제를 해결하려고했지만 아직 아무것도하지 않았습니다. 는 그래서는 RECT 버튼 (버튼을 누를) 그래서 여기에 내가 이미 한 일에서 나타나는 popview 내부 슬라이더,다른 uiviewcontroller에서 콘센트를 제어하는 ​​방법

MAINVIEW를 사용하여 UIView의 알파를 제어 할 .H 파일 :

@class popView; 
@interface brightscreenViewController : UIViewController <UIPopoverControllerDelegate> 
{  
    IBOutlet UIView *darkView; 
    IBOutlet UIButton *brightbtn; 
    UIPopoverController *popvover; 
    popView *pop; 
} 

@property(nonatomic, retain) UIPopoverController *popover; 
@property (nonatomic, retain) UIView *darkView; 
@property (nonatomic, retain) popView *pop; 

- (IBAction)showPop:(id)sender; 

의 MAINVIEW하는 .m 파일 :

#import "brightscreenViewController.h" 
#import "popView.h" 

@class popView; 
@interface brightscreenViewController() 

@end 

@implementation brightscreenViewController 
@synthesize popover; 
@synthesize darkView; 
@synthesize pop; 

-(IBAction)showPop:(id)sender 
{  
    popView *brightpop = [[popView alloc] init]; 
    popover = [[UIPopoverController alloc] initWithContentViewController:brightpop]; 
    [popover setDelegate:self]; 
    [popover presentPopoverFromRect:[brightbtn bounds] inView:brightbtn permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; 
    [popover setPopoverContentSize:CGSizeMake(229, 57)]; 
} 

및 uipopview 및 슬라이더 포함 제보기에 .H :

@class brightscreenViewController; 

@interface popView : UIViewController 
{ 

    brightscreenViewController *brightscreen; 
    IBOutlet UISlider *slider; 
} 

@property (nonatomic, retain)UISlider *slider; 
@property (nonatomic, retain) brightscreenViewController *brightscreen; 

-(IBAction)setBrightness:(id)sender; 

secondview하는 .m 파일 :

#import "popView.h" 
#import "brightscreenViewController.h" 


@interface popView() 

@end 

@implementation popView 
@synthesize slider; 
@synthesize brightscreen; 

-(IBAction)setBrightness:(id)sender 
{ 
    brightscreen.darkView.alpha = slider.value; 
} 

잘하지만 슬라이더 작품을 통해 대중. 그것은 단지 전혀 응답하지 않습니다. 나는 이미 슬라이더를 똑같은 코드를 사용하여 메인 뷰에 놓으려고하는데 잘 동작하지만 uipopover로 넣을 때 작동하지 않는다. 나는 누군가가 이것으로 나를 도울 수 있기를 바란다.

답변

1

방법에 대해 :

popView *brightpop = [[popView alloc] init]; 

// New line 
brightpop.brightscreen = self; 

popover = [[UIPopoverController alloc] initWithContentViewController:brightpop]; 
+0

이 하하, 사람이 MAGIC입니다 !!!! 당신 덕분에 필립. – redribbon

+0

흠, 한가지 더 도와 주실 수 있습니까? 모든 것이 정상적으로 작동하지만 이제 darkView 뒤에 놓인 텍스트보기는 스크롤 할 수 없게됩니다. 나는 이미 어두운면의 앞에 놓으려고하지만 텍스트는 밝아집니다. 실제로는 화면의 밝기를 설정하고 싶지만 애플은 public에 API를 제공하지 않으므로이 트릭을 사용하여 brightness.so를 설정했지만 뷰의 알파를 설정해야하지만 여전히 텍스트 뷰를 스크롤해야합니다. . 이 사람에게 어떤 제안이 있니? 미리 감사드립니다. – redribbon

+0

나는 그것을 시도하지 않았다. 답변을 알고있는 사람들이 그것을 찾을 수 있도록 새로운 질문을 시작하는 것이 좋습니다. –

관련 문제