Friday, January 10, 2014

Non-hand party, would like to implement a periodic clock, seek the guidance of some of the great God

They have achieved a simple alarm clock, but not too many ideas for the realization of a periodic clock. Great God seeking guidance on January
Reply:
You said periodic clock is not possible to set from Monday to Sunday? Then you get the current day of the week can be ah
Reply:
The server then threw after finishing the next time push data to the client in response to the alarm ........ push data may be delayed .....
Reply:
cited a floor yifuzhiming reply:
you say is not a periodic clock can be set from Monday to Sunday? Then you get the current day of the week can be ah


Ah know. I would like to ask, is there a packaged function, you can get the current day of the week. Use do not have to write it?
Reply:
reference to the second floor kuqideyupian reply:
finished after setting the next time and then threw the server to push data to the client in response to the alarm ....... The push of data may be a delay .....


Ah, but feel no need to push to the server. Just get hold of the local fine. In fact, I am not saying that knowledge really understand the server, just started learning ios development.
Reply:
references, 4th Floor lyc_omg reply:
Quote: references to the second floor kuqideyupian reply:

After setting and then threw the server after the next time push data to the client in response to the alarm ........ push data may be a delay .....


Ah, but feel no need to push to the server. Just get hold of the local fine. In fact, I am not saying that knowledge really understand the server, just started learning ios development.


With NSDate function to obtain or use some third-party open-source framework ..... But if you are a novice or recommendations to achieve this on your own familiarity is helpful because ios ios does not have the background to be functional ... So best server push ....
Reply:
references, 5th Floor kuqideyupian reply:
Quote: references to the 4th floor lyc_omg reply:

Quote: 2nd Floor reply kuqideyupian of references:

After setting and then threw the server after the next time push data to the client in response to the alarm ........ push data may be a delay .....


Ah, but feel no need to push to the server. Just get hold of the local fine. In fact, I am not saying that knowledge really understand the server, just started learning ios development.


With NSDate function to obtain or use some third-party open-source framework ..... But if you are a novice or recommendations to achieve this on your own familiarity is helpful because ios ios does not have the background to be functional ... So best server push ....

Ah, with the uilocalnotification not?
Reply:
Looks really really just checked ..... hee hee


The main code:
NSDate * now = [NSDate date];
NSCalendar * calendar = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
NSDateComponents * comps = [[NSDateComponents alloc] init];
NSInteger unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit | NSWeekdayCalendarUnit |
NSHourCalendarUnit | NSMinuteCalendarUnit | NSSecondCalendarUnit;
comps = [calendar components: unitFlags fromDate: now];
int hour = [comps hour];
int min = [comps minute];
int sec = [comps second];
/ / Get the system time -------------------------------------------- , and one assigned to the variable ---------------------





Code two:

UILocalNotification * notification = [[UILocalNotification alloc] init];
if (notification! = nil)
{

NSDate * now = [NSDate new];
notification.fireDate = [now addTimeInterval: hm]; / / set the response time in seconds
NSLog (@ "% d", hm);
notification.timeZone = [NSTimeZone defaultTimeZone];
notification.soundName = @ "ping.caf"; / / add sound
/ / Notification.alertBody = @ "TIME!";

notification.alertBody = [NSString stringWithFormat: NSLocalizedString (@ "time you set is:% i:% i.", nil), htime1, mtime1]; / / pop-up dialog

[[UIApplication sharedApplication] scheduleLocalNotification: notification];


}

No comments:

Post a Comment