首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

拨通电话的封装。和判断是否为iphone5的封装

2013-03-13 
拨打电话的封装。和判断是否为iphone5的封装??????? [alert show]??????? [alert release]??????? return

拨打电话的封装。和判断是否为iphone5的封装
??????? [alert show];
??????? [alert release];
??????? return;
??? }
??? UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:(id)[ViewControllerFactory sharedManager] cancelButtonTitle:@"取消" destructiveButtonTitle:telNum otherButtonTitles:nil, nil];
??? UIViewController *tempViewController = (id)viewController;
??? [actionSheet showInView:tempViewController.view];
??? [actionSheet release];
}
#pragma mark ====== 是否取消或者继续拨打电话 ======
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
??? NSString *telString = [actionSheet buttonTitleAtIndex:buttonIndex];
??? NSLog(@"buttonTitle===%@",[actionSheet buttonTitleAtIndex:buttonIndex]);
??? NSLog(@"%d",buttonIndex);
??? if (buttonIndex==0) {
??????? [[UIApplication sharedApplication] openURL:[NSURL URLWithString:telString]];
??? }
}




static ViewControllerFactory *classA = nil;//静态的该类的实例
+ (ViewControllerFactory *)sharedManager
{
@synchronized(self) {
??? if (!classA) {
??????? classA = [[super allocWithZone:NULL]init];
??? }
??? return classA;
}
}
+ (id)allocWithZone:(NSZone *)zone {
??? return [[self sharedManager] retain];
}
- (id)copyWithZone:(NSZone *)zone {
??? return self;
}
- (id)retain {
??? return self;
}
//- (NSUIntger)retainCount {
//??? return NSUIntgerMax;
//}
- (oneway void)release {
}
- (id)autorelease {
??? return self;
}
-(void)dealloc{
}

?

?

?

?

?

+(id)createViewControllerByControllerName:(NSString*) controllerName {
??? if (controllerName == nil || [controllerName isEqualToString:@""]) {
??????? return nil;
??? }
??? NSString *controllerXibName = nil;
??? if (isIPhone5) {
??????? controllerXibName = [NSString stringWithFormat:@"%@_iphone5",controllerName];
??? }else {
??????? controllerXibName = controllerName;
??? }
??? Class class = NSClassFromString(controllerName);
?? return? [[[class alloc] initWithNibName:controllerXibName bundle:nil] autorelease];
}

热点排行