가능한 중복은 :
Is there anyway to add same scroll menubar at the navigation bar?어떻게 여러 개의보기 컨트롤러에서 동일한 버튼을 만들 수 있습니까?
은 바보 같은 질문 일지 모르지만 it.My 질문에 따라 내 전체 프로젝트이기 때문에 나는, 어떤 희생을 치르더라도 그것을 해결하기 위해
이I가 네보기 제어기 A, B, C, D.
A는 4 개 버튼 인 btn1있다 , btn2, btn3, brn4. 내가 btn을 클릭 할 때
btn1 클릭 -> 컨트롤러 리로드 또는 현재 컨트롤러 리로드;
btn2 클릭 -> B 컨트롤러 열기;
btn3 클릭 -> C 컨트롤러 열기;
btn4 클릭 -> D 컨트롤러 열기;
B에는 btn1, btn2, btn3, brn4의 4 가지 버튼이 있습니다.입니다. 내가 btn을 클릭하면 시작됩니다.
btn1 클릭 -> 컨트롤러가 열림;
btn2 클릭 -> B 컨트롤러 다시로드 또는 현재 컨트롤러 다시로드.
btn3 클릭 -> C 컨트롤러 열기;
btn4 클릭 -> D 컨트롤러 열기;
C에는 4 개의 버튼 btn1, btn2, btn3, brn4이 있습니다. 내가 btn을 클릭하면 시작됩니다.
btn1 클릭 -> 컨트롤러가 열림;
btn2 클릭 -> B 컨트롤러 열기;
btn3 클릭 -> C 컨트롤러 다시로드 또는 현재 컨트롤러 새로 고침.
btn4 클릭 -> D 컨트롤러 열기;
D에는 4 개의 버튼 btn1, btn2, btn3, brn4이 있습니다. 내가 btn을 클릭하면 시작됩니다.
btn1 클릭 -> 컨트롤러가 열림;
btn2 클릭 -> B 컨트롤러 열기;
btn3 클릭 -> C 컨트롤러 열기;
btn4 클릭 -> D 컨트롤러 새로 고침 또는 현재 컨트롤러 새로 고침.
어떻게 처리해야합니까?
감사의 말 전진.
EDIT :가
내 이러한 제어기 (A는 B, C, D)이 TabBar의 컨트롤러에있는 버튼을 controller.I의 상단되어있는 ScrollView에 모든 이미지를 부착 한 이러한 UI로, 지금까지 내가 더 이상 질의가 물어 주시기 바랍니다 ....
이런 짓을했는지. 다시 한번 감사
편집 2 :
이 내가 tabbar
항목의 모든 컨트롤러 viewDidload
에서 가져온 버튼의있는 ScrollView입니다. 여기
scrollButtonView = [[scrollViewButtons alloc] initWithNibName:@"scrollViewButtons" bundle:nil];
CGRect frame = CGRectMake(0, 20, 320, 43);
scrollButtonView.view.frame = frame;
scrollButtonView.view.userInteractionEnabled =YES;
[self.navigationController.view addSubview:scrollButtonView.view];
내가 버튼 click.but 문제의 컨트롤러를 전환 할 코드 나 그 가져올 때, B는 C가 D가 그때 오류를 발견된다
Unknown controller
-(void)mybuttons:(id)sender{
NSLog(@"mybuttons called");
UIButton *button=(UIButton *)sender;
if (button.tag == 0) {
NSLog(@"hey have clicked first button, this is my tag : %i \n\n",button.tag);
[button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_hover.png"] forState:UIControlStateSelected]; //sets the background Image]
}
else {
[button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_normal.png"] forState:UIControlStateNormal]; //sets the background Image]
}
if (button.tag == 1) {
NSLog(@"hey have clicked second button, this is my tag : %i \n\n",button.tag);
[button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_hover.png"] forState:UIControlStateNormal]; //sets the background Image]
self.tabBarController.selectedIndex = 1;
}
else if (button.tag == 2) {
NSLog(@"hey have clicked first button, this is my tag : %i \n\n",button.tag);
[button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_hover.png"] forState:UIControlStateNormal]; //sets the background Image]
//UIViewController *newController = [[UIViewController alloc] initWithNibName:@"CustomerViewController" bundle:nil];
//UINavigationController *myCustomerController = [[[UINavigationController alloc] initWithRootViewController:newController] autorelease];
//UINavigationController *myCustomerController = [[UINavigationController alloc] initWithNibName:@"CustomerViewController" bundle:nil];
UIViewController *secondViewController = [[UIViewController alloc] initWithNibName:@"CustomerViewController" bundle:nil];
[self.navigationController pushViewController:secondViewController animated:YES];
self.tabBarController.selectedIndex = 2;
}
else if (button.tag == 3) {
NSLog(@"hey have clicked second button, this is my tag : %i \n\n",button.tag);
[button setBackgroundImage:[UIImage imageNamed:@"btn_topmenu_hover.png"] forState:UIControlStateNormal]; //sets the background Image]
//[self.navigationController pushViewController:cstViewController animated:YES];
self.tabBarController.selectedIndex = 3;
}
}
EDIT3 :
나는 어떤 방식 으로든 문제를 해결해야하므로 어떤 방식 으로든 시도했지만 간단한 문제가 생겼다. 내가 수돗물 바를 바꾸고 싶을 때이 단추를 얻는다면이 문제를 조금 다른 방식으로 해결할 수 있습니다. 대답을 보면 대답을 얻을 수 있습니다 ..
질문이 더 있습니다. 내가 어떻게 문제를 풀어야하는지.
감사의 말 전진.
지금까지 작성한 코드를 표시 할 수 있습니까? –
언젠가 전 가로 모드 (ipad에서)의 tabbar가 바닥에서 전체 길이로 오지 않기 때문에 나는이 필요성을 가지고 있습니다. 그렇지 않으면 ipad 응용 프로그램을 만들고 있지 않다면 UITabBarController가 답입니다. –
귀하의 질문을 이해할 수 없습니다. 컨트롤러 열기가 무슨 뜻인지, U 액션을 동시에로드하고 싶습니다. 그런 다음 해당 버튼에 대해 다른 선택기가있는 4 개의 대상을 추가하십시오. 그래서 단일 버튼을 사용하여 다른보기 컨트롤러를 제어 할 수 있습니다. –