UIbutton
을 내 모든보기에 tabBar와 onclick
처럼 표시해야하는 하단에 넣으려고합니다.이 기능을 구현할 수있는 방법은 무엇입니까?이 기능을 구현하려면 어떻게해야합니까? 하지만, 그래서 나에게 AppDelegate에 클래스에 버튼을 추가하여 내가 전에 이런 짓을했는지이아이폰에 tabview 컨트롤러 대신 내 모든보기 하단에 일반적인 UIButton을 추가하는 방법?
3
A
답변
2
을 달성하기위한 적절한 방법을 제안 해주십시오, 적절하게이를 달성하는 방법을 언급하지. 올바른 접근인지 아닌지는 모르지만 작동합니다. 당신이 NavigationController
를 사용하지 않는 경우
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
viewController = [[SUSAViewController alloc] initWithNibName:@"SUSAViewController" bundle:nil];
nav=[[UINavigationController alloc]initWithRootViewController:viewController];
self.window.rootViewController = nav;
UIButton *mybtn=[UIButton buttonWithType:UIButtonTypeRoundedRect];
mybtn.frame=CGRectMake(40, 200, 200, 200);
[mybtn setTitle:@"My Button" forState:UIControlStateNormal];
[nav.view addSubview:mybtn];
[self.window makeKeyAndVisible];
return YES;
}
단순히 [self.window addSubview:mybtn];
이 당신을 위해 작동합니다 희망 추가 할 수 있습니다.
0
그 버튼과 메뉴 항목 만 포함 된 BaseViewController를 만들려고 했습니까?
그런 다음 모든 View Controller가 해당 BaseViewController에서 상속 받으면 모든 View Controller에 해당 버튼이 있습니다.
// import your custom menu view
#import "CustomMenuView.h"
@interface BaseViewController : UIViewController
{
UIButton *btnMenu;
CustomMenuView *customMenu;
}
@end
...
// Now tell your other view controllers to inherit from the base view controller
#import "BaseViewController.h"
@interface YourOtherViewController: BaseViewController
{
}
@end
상속을 사용하면 모든보기 컨트롤러에 이제 해당 버튼과 메뉴가 있어야합니다.
사용할 수 1. http://www.cocoacontrols.com/controls/pushback-animation-view –
2. http://code4app.net/ios/Expandable-TabBar/4f8b96aa06f6e78e35000001 –
3.http ://www.cocoacontrols.com/controls/knsemimodalview –