应用程序的本质是与当前日期进行比较,并指定每天的输出文本(祷告时间)。 问题:当应用在当天的背景文字中显示时。如果您关闭应用程序并在所有节目正确显示后打开。
的 ViewController.h
- (void)viewDidLoad {
[super viewDidLoad];
NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar];
NSDateComponents *comp0 = [[NSCalendar autoupdatingCurrentCalendar] components:NSCalendarUnitEra | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:[NSDate date]];
NSDateComponents *comp1 = [calendar components:(NSCalendarUnitDay | NSCalendarUnitMonth ) fromDate:[NSDate date]];
NSDateComponents *comp2 = [calendar components:(NSCalendarUnitDay | NSCalendarUnitMonth ) fromDate:[NSDate date]];
NSDateComponents *comp3 = [calendar components:(NSCalendarUnitDay | NSCalendarUnitMonth ) fromDate:[NSDate date]];
NSDateComponents *comp4 = [calendar components:(NSCalendarUnitDay | NSCalendarUnitMonth ) fromDate:[NSDate date]];
[comp1 setDay:1]; [comp1 setMonth:1];
[comp2 setDay:2]; [comp2 setMonth:1];
[comp3 setDay:3]; [comp3 setMonth:1];
[comp4 setDay:4]; [comp4 setMonth:1];
if([comp1 day] == [comp0 day] &&
[comp1 month] == [comp0 month] ) {
_utr.text=@"05:44"; _voskh.text=@"07:19"; _obed.text=@"11:58"; _predz.text=@"14:12"; _vecher.text=@"16:31"; _noch.text=@"18:01";
}
if([comp2 day] == [comp0 day] &&
[comp2 month] == [comp0 month] ) {
_utr.text=@"05:44"; _voskh.text=@"07:19"; _obed.text=@"11:58"; _predz.text=@"14:13"; _vecher.text=@"16:31"; _noch.text=@"18:01";
}
if([comp3 day] == [comp0 day] &&
[comp3 month] == [comp0 month] ) {
_utr.text=@"05:44"; _voskh.text=@"07:19"; _obed.text=@"11:59"; _predz.text=@"14:14"; _vecher.text=@"16:32"; _noch.text=@"18:02";
}
if([comp4 day] == [comp0 day] &&
[comp4 month] == [comp0 month] ) {
_utr.text=@"05:44"; _voskh.text=@"07:19"; _obed.text=@"12:00"; _predz.text=@"14:15"; _vecher.text=@"16:33"; _noch.text=@"18:03";
}
ViewController.m
# Load Data Sets
training_set = tf.contrib.learn.datasets.base.load_csv_with_header(
filename = IRIS_TRAINING,
target_dtype = np.int,
features_dtype = np.float32)
答案 0 :(得分:0)
实施applicationWillEnterForeground:
(https://developer.apple.com/reference/uikit/uiapplicationdelegate/1623076-applicationwillenterforeground?language=objc)或注册相应的NSNotification,并借此机会更新您的界面。