2012-02-15 2 views
1

iPhone의 상태 표시 줄에 버튼이나 사용자 정의보기를 추가하고 싶습니다.상태 표시 줄에 단추 또는보기를 추가하려면 어떻게합니까?

상태 표시 줄을 사용자 정의 할 수없는 경우에는 상태 표시 줄에 단추를 추가하거나 볼 수있는 것보다 ...

저와 함께 공유 해주시기 바랍니다.

감사합니다,

+0

내가 하나라도 그것은 또한 –

+2

이 SO 게시물에 당신을 도울 수 나에게 완전한 도움이 될 것입니다 응답 좋은 아이디어 http://stackoverflow.com/questions/2833724/adding-view -on-statusbar-in-iphone – Maulik

+0

고마워 Maulik ... 나는 그것을 원해. .. :) – Raj

답변

1

기본 상태 표시 줄을 숨기고 상태 표시 줄과 같은 높이로 정의 막대를 생성하고보기에 표시 할 수있다. Apple은 색상 (회색/검은 색), 불투명도 (불투명/반투명) 및 표시 여부 (숨김/표시) 변경 이외의 상태 표시 줄을 사용자 정의 할 수 없습니다.

+0

괜 찮 아 요 괜 찮 아 요하지만 상태 바에 어떤 이벤트를 추가 할 수 있습니까? – Raj

+0

어떤 유형의 이벤트입니까? –

+0

예를 들어 터치 이벤트 ... – Raj

1
[[UIApplication sharedApplication]setStatusBarHidden:YES withAnimation:NO]; 

// Create window 
UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0,0,320,20)]; 
statusWindow.windowLevel = UIWindowLevelStatusBar; 
statusWindow.backgroundColor=[UIColor redColor]; 

// Dont make the statusWindow keyWindow or the keyboard won't work! 
// [statusWindow makeKeyAndVisible]; 

// Create statusBarButton 
UIButton *statusBarButton = [UIButton buttonWithType:UIButtonTypeContactAdd]; 

statusBarButton.frame = CGRectMake(230, 2, 15, 15); 
statusBarButton.backgroundColor=[UIColor redColor]; 
[statusBarButton addTarget:self action:@selector(goTop) forControlEvents:UIControlEventTouchUpInside]; 

// Place button into the new window 

    // Instead, add this: 
[self.window makeKeyAndVisible]; // has to be main window of app 
statusWindow.hidden = NO; 

[statusWindow addSubview:statusBarButton]; 
1

UIWindow *statusWindow = [[UIWindow alloc] initWithFrame:CGRectMake(0,0,320,20)]; 
statusWindow.windowLevel = UIWindowLevelStatusBar; 
statusWindow.backgroundColor=[UIColor redColor]; 
관련 문제