小编sad*_*esh的帖子

需要在特定秒内在App Delegate中显示一个特定视图

虽然推送通知收到需要在AppDelegate中显示一个特定视图(推视图)30秒后它想要消失.整个项目我在storyboard中做了.单击特定视图中设计的按钮(推视图),需要转到我在故事板中设计的主页.

iphone objective-c ios7 xcode5

5
推荐指数
1
解决办法
49
查看次数

当我们过去一年时,显示每个月的周和日列表

NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = @"yyyy";
NSDate *date = [dateFormatter dateFromString:@"2011"];

NSCalendar *calendar = [[NSCalendar alloc]initWithCalendarIdentifier:NSGregorianCalendar];

NSDateComponents *oneDayAgoComponents = [[NSDateComponents alloc] init];

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[oneDayAgoComponents setMonth:0];
NSUInteger numWeekdays = [calendar maximumRangeOfUnit:NSWeekdayCalendarUnit].length;
int w = numWeekdays;
for(int currentdateindexpath=0;currentdateindexpath<=12;currentdateindexpath++)
{
    [formatter setDateFormat:@"MMMM yyyy"];

    [oneDayAgoComponents setMonth:currentdateindexpath];
    NSDate *monthAgo = [calendar dateByAddingComponents:oneDayAgoComponents
                                                 toDate:date
                                                options:0];


    NSString *montYear = [formatter stringFromDate:monthAgo];

    NSDateComponents* subcomponent = [calendar components:NSWeekdayCalendarUnit
                                                 fromDate:date];


    [subcomponent setWeek:currentdateindexpath];
    [formatter setDateFormat:@"'week'W"];
    NSString *stringFromDate = [formatter stringFromDate:monthAgo];
    // Get the …
Run Code Online (Sandbox Code Playgroud)

iphone nsdate nscalendar ios

5
推荐指数
1
解决办法
223
查看次数

标签 统计

iphone ×2

ios ×1

ios7 ×1

nscalendar ×1

nsdate ×1

objective-c ×1

xcode5 ×1