UIView-Image & local time acquisition

Source: Internet
Author: User

Convert UIView to pictures

Uigraphicsbeginimagecontext (self.rootsView.bounds.size);

[_rootsview.layer Renderincontext:uigraphicsgetcurrentcontext ()];

UIImage *viewbeimage = Uigraphicsgetimagefromcurrentimagecontext ();

Uigraphicsendimagecontext ();

return viewbeimage;

local time

NSDate *now = [NSDate Date];
Nscalendar *calendar = [Nscalendar Currentcalendar];
Nsuinteger unitflags = Nscalendarunityear | Nscalendarunitmonth | Nscalendarunitday | Nscalendarunithour | Nscalendarunitminute | Nscalendarunitsecond;
nsdatecomponents *datecomponent = [Calendar components:unitflags Fromdate:now];
Nsinteger year = [Datecomponent year];//
Nsinteger month = [datecomponent month];//months
Nsinteger day = [Datecomponent day];//
Nsinteger hour = [Datecomponent hour];//hours
Nsinteger minute = [datecomponent minute];//min
Nsinteger second = [datecomponent second];//seconds
NSLog (@ "Year was:%ld", year);
NSLog (@ "Month is:%ld", month);
NSLog (@ "Day was:%ld", day);
NSLog (@ "Hour is:%ld", hour);
NSLog (@ "Minute is:%ld", minute);
NSLog (@ "Second is:%ld", second);

UIView-Image & local time acquisition

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.