仿iphone原生的时钟程序

本文介绍了作者在构建时钟应用、新闻客户端及音乐播放器过程中的经验分享,包括使用开源时钟库、标签栏与导航栏的设计,以及下一步计划开发的图片浏览器改进方向。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

还没做完,时钟部分做了一点,用的开源的时钟。

先截图可能效果:


采用的是标签栏加导航栏的方式。

关键的就那么几行代码。

NSString *cellIdentifer = @"cell1"; //[tableView registerClass:

[UITableViewCell class] forCellReuseIdentifier:cellIdentifer];

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifer];

//NSString *str =[[NSDate date] description];

NSDate *date = [NSDate date];

NSCalendar *cal = [NSCalendar currentCalendar];

NSDateComponents *components = [cal components:NSHourCalendarUnit fromDate:date];

NSString *strHour = [NSString stringWithFormat:@"%ld", (long)[components hour]];

NSString *strMinute = [NSString stringWithFormat:@"%ld", (long)[components minute]];

myhour = [strHour intValue]; myminute = [strMinute intValue];

UIView *clockView = (UIView *)[cell viewWithTag:100];

CGRect clockFrame = CGRectMake(0,0,CGRectGetWidth(self.view.bounds)*0.25,CGRectGetHeight(self.view.bounds)*0.25);

self.clock = [[ALDClock alloc] initWithFrame:clockFrame]; // Put the clock in the centre of the frame self.clock.center = clockView.superview.center; [clockView addSubview:self.clock]; [self applyClockCustomisations]; // Uncomment the following line to preserve selection between presentations. cell.accessoryType = UITableViewCellAccessoryNone;


我还想做个新闻客户端,一个音乐播放器,一个计算器。

最近做的一个图片浏览器做的不是很好看,下次改进分享。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值