FirstViewController *firstVC = [[FirstViewController alloc] init];
UINavigationController *navigation = [[UINavigationController alloc] initWithRootViewController:firstVC];
navigation.navigationBar.translucent = YES;
self.window.rootViewController = navigation;
[firstVC release];
[navigation release];
return YES;
}
@property (nonatomic, copy)NSString *youName, *herName;
- (void)test {
if (yourTF.text.length == 0 || herTF.text.length == 0) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:@"名字不能为空" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alertView show];
return;
}
SecondViewController *secondVC = [[SecondViewController alloc] init];
secondVC.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
[self presentViewController:secondVC animated:YES completion:nil];
}
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"%s", __FUNCTION__);
self.view.backgroundColor = [UIColor cyanColor];
NSArray *array = @[@"你们的爱情基础非常深厚,牢不可破,然而却因为求学或工作的原因,使得你们分隔两地,聚少离多。也许是因为相聚短暂而益显珍贵,而e信来往,电话传情给你们平添一份情调。",
@" 你们是众人眼中的神仙眷侣,站在一起怎么看怎么般配,很有传说中的夫妻相。你们之间或许没有惊天地泣鬼神的爱情神话,或许没有刻骨铭心的激情,但是你的之间的温情和默契却能让你们的心越走越近,一起慢慢变老。",
@"你们是如此的匹配,如此和谐,往往是你刚想说“可惜”他已经开始叹惜。你们性格相合,有共同的爱好,品味一致。就是这么默契,令人们羡慕得不得了。没办法,谁叫你们连姓名的笔画也一样呢。",
@"你们俩的姻缘线诡异,连鄙人也无法测算。",
@" 你们的感情一般是从学生时代开始的,那青涩的恋爱留给你们酸酸甜甜的味道让你们用一生去怀念彼此,但是你们的爱情却注定了没有结果,你们会试着遗忘对方,开始自己新的生活,但心中那最温柔的角落一直被初恋占据。",
@"你们前世是冤家,今生做情侣,所以就难免有一些不和谐的音符出现来折磨你们的爱情。你们的感情大起大落,分分合合,不过你们最终会修成正果,恩爱到老的。"];
NSString *string = [NSString stringWithFormat:@"%@和%@的测试结果:\n%@", _youName, _herName, array[arc4random() % 6]];
NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:17]};
CGRect rect = [string boundingRectWithSize:CGSizeMake(335, 0) options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:dic context: nil];
UILabel *resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 84, 335, rect.size.height)];
resultLabel.text = string;
resultLabel.numberOfLines = 0;
resultLabel.backgroundColor = [UIColor whiteColor];
[self.view addSubview:resultLabel];
}