SEBlingLord是一个iOS SpringBoard视图控制器类(就象iPhone/iPad的主屏幕)。设置非常简单。请见下文。
vc1 = [[MyFacebookViewController alloc] initWithNibName:@"MyFacebookViewController" bundle:nil];
vc2 = [[MyTwitterViewController alloc] initWithNibName:@"MyTwitterViewController" bundle:nil];
// create or reference more view controllers here
// ... also be sure to extend your view controllers from SEBlingLordViewController
NSString *facebookIconPath = [[NSBundle mainBundle] pathForResource: @"facebook" ofType: @"png"];
UIImage *facebookIcon = [UIImage imageWithContentsOfFile: iconPath];
NSString *twitterIconPath = [[NSBundle mainBundle] pathForResource: @"twitter" ofType: @"png"];
UIImage *twitterIcon = [UIImage imageWithContentsOfFile: iconPath];
CGRect menuItemFrame = CGRectMake(0.0f, 0.0f, 60.0f, 60.0f);
// these first two menu items automatically push the user to the specified view controller when they're tapped
SEBlingLordMenuItem *item1 =
[[SEBlingLordMenuItem alloc] initWithFrame: menuItemFrame
title: @"Facebook"
image: facebookIcon
removable: NO
canTriggerEditing: NO
viewController: vc1];
SEBlingLordMenuItem *item2 =
[[SEBlingLordMenuItem alloc] initWithFrame: menuItemFrame
title: @"Twitter"
image: twitterIcon
removable: NO
canTriggerEditing: NO
viewController: vc2];
// this menu item executes a block when it's tapped
SEBlingLordMenuItem *item3 =
[[SEBlingLordMenuItem alloc] initWithFrame: menuItemFrame
title: @"Some alert"
image: someOtherIcon
removable: NO
canTriggerEditing: NO
tapHandlerBlock: ^{
UIAlertView *someStupidAlert = ...
// ... etc.
// note that the block is a simple dispatch_block_t,
// i.e., it takes no params and returns void.
}];
// ... etc
// create an array containing the menu items and pass it to a newly created SEBlingLordView
NSArray *items = [NSArray arrayWithObjects: item1, item2, item3, nil];
SEBlingLordView *board = [[SEBlingLordView alloc] initWithFrame: self.view.frame
itemSize: menuItemFrame.size
itemMargins: CGSizeMake(15.0f, 15.0f)
outerMargins: CGSizeMake(10.0f, 10.0f)
items: items];
// ... and add the BlingLordView to your view
[self.view addSubview:board];
// add more menu items later if necessary
[board addMenuItem: item4];
[board addMenuItems: [NSArray arrayWithObjects: item5, item6, item7, nil]];
// and remove them as well
[board removeMenuItemAtIndex:4 animate:NO];
[board removeAllMenuItems];
敬请期待,可能会有更多内容。
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004
版权 (C) 2004 Sam Hocevar <[email protected]>
每个人都可以复制和分发原始或修改后的此许可证文件的副本,并更改它,只要更改名称。
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION