Home Php C# Sql C C++ Javascript Python Java Go Android Git Linux Asp.net Django .net Node.js Ios Xcode Cocoa Iphone Mysql Tomcat Mongodb Bash Objective-c Scala Visual-studio Apache Elasticsearch Jar Eclipse Jquery Ruby-on-rails Ruby Rubygems Android-studio Spring Lua Sqlite Emacs Ubuntu Perl Docker Swift Amazon-web-services Svn Html Ajax Xml Java-ee Maven Intellij-idea Rvm Macos Unix Css Ipad Postgresql Css3 Json Windows-server Vue.js Typescript Oracle Hibernate Internet-explorer Github Tensorflow Laravel Symfony Redis Html5 Google-app-engine Nginx Firefox Sqlalchemy Lucene Erlang Flask Vim Solr Webview Facebook Zend-framework Virtualenv Nosql Ide Twitter Safari Flutter Bundle Phonegap Centos Sphinx Actionscript Tornado Register | Login | Edit Tags | New Questions | 繁体 | 简体


10 questions online user: 59

0
votes
answers
30 views
+10

在AFNetworking的同一線程中執行某些操作

0

我正在使用Objective-C。我們知道AFNetworking正在另一個線程中工作,但如果我想在互聯網請求後做些什麼呢。在AFNetworking的同一線程中執行某些操作

例如:

- (BOOL)checkPassword 
{ 

    self.loginPermit = NO; 

    AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; 
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; 
    NSDictionary *parameters = @{@"username": self.username, @"password": self.password}; 

    [manager POST:self.URL parameters:parameters progress:nil 
      success:^(NSURLSessionDataTask *task, id responseObject) 
    { 
     NSDictionary *dict = (NSDictionary *)responseObject; 
     if ([[dict objectForKey:@"msg"] isEqualToString:@"00001"]){ 
      self.loginPermit = YES 
     } 
     else { 
      self.loginPermit = NO; 
     } 
    } failure:^(NSURLSessionDataTask *task, NSError *error) { 
     NSLog(@"Error: %@", error); 
    }]; 

    return self.loginPermit; 
} 

但它不會返回每一次。如何在互聯網請求後返回該值。

+0

您需要在完成塊中做任何事情 - 在這裏設置'loginPermit'屬性。可能最好的方法是將一個塊傳遞給checkPassword方法而不是讓checkPassword返回一個Bool – Paulw11

沙发
0
0

您應該爲此使用塊。

[self checkPassword:^(BOOL loginPermit) { 
    if(loginPermit){ 
     // do your stuff 
    } 
}]; 


- (void)checkPassword:(void(^)(BOOL loginPermit))completion 
{ 

BOOL loginPermit = NO; 

// show indicator 

AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; 
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; 
NSDictionary *parameters = @{@"username": self.username, @"password": self.password}; 

[manager POST:self.URL parameters:parameters progress:nil 
     success:^(NSURLSessionDataTask *task, id responseObject) 
    { 
     //hide indicator 

    NSDictionary *dict = (NSDictionary *)responseObject; 
    if ([[dict objectForKey:@"msg"] isEqualToString:@"00001"]){ 
     loginPermit = YES; 
    } 
    else { 
     loginPermit = NO; 
    } 

    completion (loginPermit); 

    } failure:^(NSURLSessionDataTask *task, NSError *error) { 
    NSLog(@"Error: %@", error); 

    //hide indicator 
    completion (loginPermit); 
    }]; 
} 
+0

我應該用__block聲明loginPermit BOOL loginPermit; –

+0

是的,你可以做到。 – iOSEnthusiatic

109
votes
answers
15 views
+10

Adding a simple UIAlertView

What is some starter code I could use to make a simple UIAlertView with one "OK" button on it?

沙发
+670

其他答案已經提供了iOS 7及更早版本的信息,但iOS 8中不推薦使用 UIAlertView

在iOS 8+中你應該使用<代碼> UIAlertController 它是 UIAlertView UIActionSheet 的替代品。文檔: UIAlertController類參考關於 NSHipster 的一篇很好的文章。

要創建一個簡單的警報視圖,你可以做以下:

  UIAlertController * alertController = [UIAlertController alertControllerWithTitle:@“Title”消息:@“Message”preferredStyle:UIAlertControllerStyleAlert]; //我們通過創建UIAlertActions向警報控制器添加按鈕:UIAlertAction * actionOk = [UIAlertAction actionWithTitle:@“Ok”style:UIAlertActionStyleDefault handler:nil]; //你可以在這裡使用一個塊來處理按下這個按鈕[alertController addAction:actionOk]; [self presentViewController:alertController animated:YES completion:nil];   

Swift 3/4:

  let alertController = UIAlertController(標題:“標題”,消息:“消息”,preferredStyle:.alert)//我們通過創建UIAlertActions向警報控制器添加按鈕:let actionOk = UIAlertAction(標題:“OK” “,style:.default,handler:nil)//你可以在這裡使用一個塊來處理按鈕這個按鈕alertController.addAction(actionOk)self.present(alertController,animated:true,completion:nil)  

請注意,由於它是在iOS 8中添加的,因此該代碼不適用於iOS 7及更早版本。所以,遺憾的是,現在我們必須使用類似的版本檢查:

  NSString * alertTitle = @“Title”; NSString * alertMessage = @“消息”; NSString * alertOkButtonText = @“Ok”; if([UIAlertController class] == nil){// [UIAlertController class]在iOS 7及更早版本上返回nil。您可以使用任何方法來檢查系統版本是否為iOS 8+ //從Xcode 9開始,您還可以使用// if(@available(iOS 8,*)){UIAlertView * alertView = [[UIAlertView alloc ] initWithTitle:alertTitle消息:alertMessage委託:nil cancelButtonTitle:nil otherButtonTitles:alertOkButtonText,nil]; [alertView show]; } else {UIAlertController * alertController = [UIAlertController alertControllerWithTitle:alertTitle message:alertMessage preferredStyle:UIAlertControllerStyleAlert]; //我們通過創建UIAlertActions向警報控制器添加按鈕:UIAlertAction * actionOk = [UIAlertAction actionWithTitle:alertOkButtonText style:UIAlertActionStyleDefault handler:nil]; //你可以在這裡使用一個塊來處理按下這個按鈕[alertController addAction:actionOk]; [self presentViewController:alertController animated:YES completion:nil]; }   

Swift 3/4:

  let alertTitle =“Title”let alertMessage =“Message”let alertOkButtonText =“好”
     
			
        
板凳
+110

UIAlertView在iOS 8上已棄用。因此,要在iOS 8及更高版本上創建警報,建議使用UIAlertController:

  UIAlertController * alert = [UIAlertController alertControllerWithTitle:@“Title “message:@”Alert Message“preferredStyle:UIAlertControllerStyleAlert]; UIAlertAction * defaultAction = [UIAlertAction actionWithTitle:@“Ok”style:UIAlertActionStyleDefault handler:^(UIAlertAction * action){//在此處輸入代碼}]; [alert addAction:defaultAction]; //在需要的地方顯示動作[self presentViewController:alert animated:YES completion:nil];   

這就是我實現它的方式。

地板
+90
  UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@“Title”message:@“Message”delegate:nil //或self cancelButtonTitle:@“OK”otherButtonTitles:nil]; [警示顯示]; [alert autorelease];  
     
			
        
4楼
+90
  UIAlertView * myAlert = [[UIAlertView alloc] initWithTitle:@“Title”message:@“Message”delegate:self cancelButtonTitle:@“Cancel”otherButtonTitles:@“Ok”,nil]; [myAlert show];  
     
			
        
5楼
+90

作為前兩個答案(用戶“sudo rm -rf”和“Evan Mulawski”)的補充,如果您在單擊警報視圖時不想執行任何操作,則可以分配,顯示和釋放它。您不必聲明委託協議。

6楼
+30
<p>這是一個完整的方法,只有一個按鈕,一個'ok',關閉UIAlert:</ p> <pre> <code> - (void)myAlert:(NSString *)errorMessage {UIAlertView * myAlert = [[UIAlertView alloc] initWithTitle:errorMessage message:@“”delegate:self cancelButtonTitle:nil otherButtonTitles:@“ok”,nil]; myAlert.cancelButtonIndex = -1; [myAlert setTag:1000]; [myAlert show]; } </ code> </ pre>
7楼
+10

此頁面顯示瞭如果使用Swift如何添加UIAlertController

8楼
0

使用數組數據的簡單警報:

  NSString * name = [[YourArray objectAtIndex:indexPath.row] valueForKey:@“Name”]; NSString * msg = [[YourArray objectAtIndex:indexPath.row] valueForKey:@“message”]; UIAlertView * alert = [[UIAlertView alloc] initWithTitle:name message:msg delegate:self cancelButtonTitle:@“OK”otherButtonTitles:nil]; [警示顯示];  
     
			
        
9楼
-10

對於Swift 3:

  let alert = UIAlertController(標題:“Alert”,消息:“Message”,preferredStyle:UIAlertControllerStyle.alert)alert.addAction(UIAlertAction(標題:“OK) “,style:UIAlertActionStyle.default,handler:nil))self.present(alert,animated:true,completion:nil) 
     
			
        
0
votes
answers
16 views
+10

Objective C: Reading text files

I've done this before, but its not working for me now. I'm doing:

NSString* path = [[NSBundle mainBundle] pathForResource:@"test" 
                                                 ofType:@"txt"];
NSString* content = [NSString stringWithContentsOfFile:path
                                              encoding:NSUTF8StringEncoding
                                                 error:NULL];
NSLog(@"%@",path);

and it returns (null) every time when I NSLog path and content. Can anyone see what I'm doing wrong?

0
votes
answers
10 views
+10

What format string do I use for milliseconds in date strings on iPhone?

I'm required to parse strings in a format that includes milliseconds. What format string do I use to get the right date value?

For example, suppose I have a string with the following value: "2011-06-23T13:13:00.000"

What format string do I pass to my NSDateFormatter in the following code?

NSString *dateValue = @"2011-06-23T13:13:00.000";
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
NSString *formatString = @"yyyy-MM-dd'T'HH:mm:ss.???";
[formatter setDateFormat:formatString];
NSDate *date = [formatter dateFromString:dateValue];

What do I use in place of ??? in the code above?

0
votes
answers
22 views
+10

啓動主應用程序

5

在Mac OS X(LoginItem)助手應用程序我有一個應用程序Main.app和應用Helper.app的Main.app/Library/LoginItems文件夾內。 Main.app可以由用戶啓動,然後用戶可以將Helper.app設置爲登錄項目。 (使用SMLoginItemSetEnabled()),這可以很好地工作。當用戶將Helper.app設置爲登錄項時,它也會啓動。啓動主應用程序

但是,也應該可以啓動Helper.app而不將其設置爲登錄項目。我試着

[[NSWorkspace sharedWorkspace] launchApplication: newPath]; 

這給lsboxd做到這一點:不使工藝推出...錯誤,並與

[NSTask launchedTaskWithLaunchPath:newPath arguments: [NSArray array]]; 

至極給人否認禁止-sandbox- reinit錯誤。 (?大概是因爲Helper.app是 Main.app)

NEWPATH發現如下:

NSMutableArray *pathComponents = [NSMutableArray arrayWithArray:[[[NSBundle mainBundle] bundlePath] pathComponents]]; 
[pathComponents addObject:@"Contents"]; 
[pathComponents addObject:@"Library"]; 
[pathComponents addObject:@"LoginItems"]; 
[pathComponents addObject:@"Helper.app"]; 
[pathComponents addObject:@"Contents"]; 
[pathComponents addObject:@"MacOS"]; 
[pathComponents addObject:@"Helper"]; 
NSString *newPath = [NSString pathWithComponents:pathComponents]; 

我怎麼能解決這個問題? :)

謝謝,

+0

http://stackoverflow.com/questions/12971549/mac-os-sandbox-launching-main-application-from-helper - 它可以* *是一個簽約的問題是會消失,一旦應用程序在應用程序商店 – Petesh 2013-03-12 17:11:26

+0

1Password(使用1Password Helper進程)似乎可以執行此操作,並且它們已被沙箱化。我真的很想知道他們是如何實現的。 – 2013-09-22 18:19:27

+0

我也在搜索這個,我只是按照你描述的方式來嘗試它(除了我對硬件代碼進行了硬編碼,我真的不明白你爲什麼要這麼做),它馬上就能正常工作。我不知道你做錯了什麼(或者如果我做錯了什麼,這使它對我有用)。 – Sitses 2013-10-10 23:22:34

沙发
0
0

您也可以使用NSTask和launchctl。 示例 或者您可以使用NSTask和bash腳本。 例子:

#Run Menu 
if [ $(ps -u $USERNAME | grep -v grep | grep -m1 '/Library/Menu/Menu.app/Contents/MacOS/Menu' | awk '{print $5}') ]; then 
    echo "Menu already running"; 
else 
    echo "Menu not running" 
    if [ $(users $USERNAME) == $USERNAME ]; then 
     echo "User logined" 
     echo "running menu for user $USERNAME" 
     sudo -u $USERNAME /Library/Menu/Menu.app/Contents/MacOS/Menu& 
    else 
     echo "User not logined" 
    fi 
fi 
419
votes
answers
10 views
+10

What is the significance of #pragma marks? Why do we need #pragma marks?

What is the purpose of #pragma marks in Xcode? Does their location in .m files matter? Should some #pragma come before all others?

  • Do they have to be present?
  • Can new marks be added? Why would they be? What causes it?
  • Is there any harm in having a mark removed? Would one ever want to?
沙发
+3080

#pragma mark directives show up in Xcode in the menus for direct access to methods. They have no impact on the program at all.

For example, using it with Xcode 4 will make those items appear directly in the Jump Bar.

There is a special pragma mark - which creates a line.

enter image description here

感謝答案 - 您是否能夠發布更新的答案,顯示新XCode中的pragma標記(在該菜單中或現在的任何位置)? - user7804781 18年7月27日17:54

是否有Python等價物? - 愛德華福克1月31日0:04

@EdwardFalk這是IDE特定的,所以它真的取決於你的IDE /文本編輯器 - Michael Ozeryansky 4月9日2:20

板凳
+530

#pragma mark is used to tag the group of methods so you may easily find and detect methods from the Jump Bar. It may help you when your code files reach about 1000 lines and you want to find methods quickly through the category from Jump box.

In a long program it becomes difficult to remember and find a method name. So pragma mark allows you to categorize methods according to the work they do. For example, you tagged some tag for Table View Protocol Methods, AlertView Methods, Init Methods, Declaration etc.

#pragma mark is the facility for XCode but it has no impact on your code. It merely helps to make it easier to find methods while coding.

地板
+200

In simple word we can say that #pragma mark - is used for categorizing methods, so you can find your methods easily. It is very useful for long projects.

4楼
+130

Just to add the information I was looking for: pragma mark is Xcode specific, so if you deal with a C++ project that you open in different IDEs, it does not have any effect there. In Qt Creator, for example, it does not add categories for methods, nor generate any warnings/errors.

EDIT

#pragma is a preprocessor directive which comes from C programming language. Its purpose is to specify implementation-dependent information to the compiler - that is, each compiler might choose to interpret this directive as it wants. That said, it is rather considered an extension which does not change/influence the code itself. So compilers might as well ignore it.

Xcode is an IDE which takes advantage of #pragma and uses it in its own specific way. The point is, #pragma is not Xcode and even Objective-C specific.

5楼
+110

When we have a big/lengthy class say more than couple 100 lines of code we can't see everything on Monitor screen, hence we can't see overview (also called document items) of our class. Sometime we want to see overview of our class; its all methods, constants, properties etc at a glance. You can press Ctrl+6 in XCode to see overview of your class. You'll get a pop-up kind of Window aka Jump Bar.

By default, this jump bar doesn't have any buckets/sections. It's just one long list. (Though we can just start typing when jump Bar appears and it will search among jump bar items). Here comes the need of pragma mark

If you want to create sections in your Jump Bar then you can use pragma marks with relevant description. Now refer snapshot attached in question. There 'View lifeCycle' and 'A section dedicated ..' are sections created by pragma marks

6楼
+90

While searching for doc to point to about how pragma are directives for the compiler, I found this NSHipster article that does the job pretty well.

I hope you'll enjoy the reading

7楼
+50
#pragma mark - NSSecureCoding

The main purpose of "pragma" is for developer reference.enter image description here

You can easily find a method/Function in a vast thousands of coding lines.

所以我可以刪除線路?它浪費了我的大腦空間。 - YumYumYum 2017年2月16日16:25

刪除#pragma-mark不會影響代碼的任何功能,但您的代碼可能會失去其可讀性。如果你真的不想要,你可以刪除它。 - Jeba Moses於2017年2月17日9:21

太棒了!! 我真的很討厭#pragma-mark以及與編譯器/構建/執行無關的所有其他東西。 - YumYumYum 2017年2月17日20:27

232
votes
answers
16 views
+10

Get Selected index of UITableView

I want to have selected index for UITableView. I have written following code:

NSIndexPath *index = [NSIndexPath indexPathForRow:1 inSection:0];
[tableView scrollToRowAtIndexPath:index 
                 atScrollPosition:UITableViewScrollPositionTop 
                         animated:YES];

This always work for 1st item. I want to have selected index in indexPathForRow.

Please help. Thanks.

up vote 214 down vote accepted favorite
沙发
+2140
+50
  NSIndexPath * selectedIndexPath = [tableView indexPathForSelectedRow];  
     
			
        
+80

獲取當前選定的行。如果你只有一個部分可能會有所幫助。

   - (NSUInteger)currentSellectedRowIndex {NSIndexPath * selectedIndexPath = [self.tableView indexPathForSelectedRow]; if(selectedIndexPath){return selectedIndexPath.row; } else {return NSNotFound; }}  
     
			
        
+50

使用此代碼

  CGPoint location = [sender locationInView:self.tableView]; NSIndexPath * swipedIndexPath = [self.tableView indexPathForRowAtPoint:location]; UITableViewCell * swipedCell = [self.tableView cellForRowAtIndexPath:swipedIndexPath]; NSIndexPath * indexPath = [self.tableView indexPathForCell:swipedCell];  
     
			
        
+40

在didSelectRowAtIndexPath中,將聲明為NSIndexPath的接口設置為返回的索引路徑。然後您可以滾動到該變量。如果您需要幫助,請發表評論並提供一些示例代碼。

示例代碼:pastie.org/1254081 - Kolin Krewinkel 2010年10月27日23:02

或者,您可以使用Chris的方法更快地使用。上述方法提供了更多控制,可以通過您的(示例)詳細視圖控制器進行修改。 - Kolin Krewinkel 2010年10月27日23:04

+10

Swift 4.2

  let selectedIndexPath = tableView.indexPathForSelectedRow   

這是一個可選的返回值。

0
votes
answers
20 views
+10

IOS:兩人在一個UIAlert

0

按鈕控件我有這樣的代碼在IBAction爲:IOS:兩人在一個UIAlert

UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"NO!" 
                 message:@"danger" 
                 delegate:self 
               cancelButtonTitle:@"OK" 
               otherButtonTitles:@"Annul", nil]; 

    [alertView show]; 
    [alertView release]; 

現在,如果我按「OK」必須做的事,如果我把「年度審覈及年度」必須做的另一件事。但它必須在IBAction內完成。

+1

「必須在IBAction內完成」..你是什麼意思?爲什麼不使用UIAlertviewDelegate回調clickedButtonAtIndex – Krishnabhadra 2011-06-01 11:13:18

沙发
0
1

Jhaliya的答案是偉大的,但它並沒有解決blackguardian的請求,IBAction方法中運行這些。有一個IBAction方法阻塞並等待來自UIAlertView的響應是在CocoaTouch中工作的錯誤方法。 IBAction應該只顯示UIAlertView。然後Jhaliya的答案中的委託功能應解析繼續的方式,「OK」或「Annul」。然後該委託函數可以執行該操作(可能通過調用其他方法)。 CocoaTouch的事件處理不適用於IBAction方法阻止等待進一步的用戶輸入。

覺得鏈IBAction->UIAlertView->alertView:clickedButtonAtIndex:的作爲只是不使用UIAlertView時,並將其放置在IBAction你當前的代碼這條產業鏈後IBAction

+0

aaaaah ....好的....你的解釋很清楚...謝謝 – CrazyDev 2011-06-01 13:18:56

板凳
0
9

您需要實施UiAlertViewDelegate方法。

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 

所以委託函數應該如下所示。

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
    { 
      if(buttonIndex == 0)//OK button pressed 
      { 

      } 
      else if(buttonIndex == 1)//Annul button pressed. 
      { 

      } 
    } 
+0

如果我使用這個方法委託在ibaction中有效果? – CrazyDev 2011-06-01 11:14:57

+0

+1)@blackgaurdian,爲什麼你在ibaction中生效。 – Ishu 2011-06-01 11:31:08

+0

我解釋我的問題:如果我按下OK,則Ib操作繼續執行其操作,而如果按下Annul,則IBAction的指令爲「返回」; – CrazyDev 2011-06-01 13:15:28

0
votes
answers
7 views
+10

如何在Objective-c中獲得下週的開始和結束日期?

0

我已經嘗試下週開始和結束日期,但是我已經獲得了本週的開始和結束日期。如何在Objective-c中獲得下週的開始和結束日期。如何在Objective-c中獲得下週的開始和結束日期?

+2

證明你有試過嗎? –

沙发
0
1

您可以使用下面的代碼獲得這個星期和下個星期的所有日期: -

NSArray * allDatesOfThisWeek = [self daysThisWeek]; 
NSArray * allDatesOfNextWeek = [self daysNextWeek]; 

以下方法用於計算該周的日期: -

-(NSArray*)daysThisWeek 
{ 
    return [self daysInWeek:0 fromDate:[NSDate date]]; 
} 

-(NSArray*)daysNextWeek 
{ 
    return [self daysInWeek:1 fromDate:[NSDate date]]; 
} 
-(NSArray*)daysInWeek:(int)weekOffset fromDate:(NSDate*)date 
{ 
    NSCalendar *calendar = [NSCalendar currentCalendar]; 

    //ask for current week 
    NSDateComponents *comps = [[NSDateComponents alloc] init]; 
    comps=[calendar components:NSWeekCalendarUnit|NSYearCalendarUnit fromDate:date]; 
    //create date on week start 
    NSDate* weekstart=[calendar dateFromComponents:comps]; 

    NSDateComponents* moveWeeks=[[NSDateComponents alloc] init]; 
    moveWeeks.weekOfYear=weekOffset;    
    weekstart=[calendar dateByAddingComponents:moveWeeks toDate:weekstart options:0]; 


    //add 7 days 
    NSMutableArray* week=[NSMutableArray arrayWithCapacity:7]; 
    for (int i=1; i<=7; i++) { 
     NSDateComponents *compsToAdd = [[NSDateComponents alloc] init]; 
     compsToAdd.day=i; 
     NSDate *nextDate = [calendar dateByAddingComponents:compsToAdd toDate:weekstart options:0]; 
     [week addObject:nextDate]; 

    } 
    return [NSArray arrayWithArray:week]; 
} 

如果你想從今天獲得下週的日期,然後通過weekOffset = 2像這樣: -

NSArray * allDatesOfNextToNextWeek = [self daysInWeek:2 fromDate:now]; 

如果你希望從今天獲得前一週的日期,然後通過weekOffset = -1是這樣的: -

NSArray * allDatesOfPreviousWeek = [self daysInWeek:-1 fromDate:now]; 

希望,這是你在找什麼。任何擔心都會回到我身上。

板凳
0
0

NSCalendar包含專用的方法來做到這一點,例如nextDateAfterDate:matchingUnit:value:options:dateByAddingComponents:toDate:options:

// Get the current calendar 
NSCalendar *calendar = [NSCalendar currentCalendar]; 
// Get the next occurrence for the first weekday of the current calendar 
NSDate *startOfNextWeek = [calendar nextDateAfterDate:[NSDate date] matchingUnit:NSCalendarUnitWeekday value:calendar.firstWeekday options:NSCalendarMatchStrictly]; 
// Create new date components +7 days and -1 seconds 
NSDateComponents *endOfNextWeekComponents = [[NSDateComponents alloc] init]; 
endOfNextWeekComponents.day = 7; 
endOfNextWeekComponents.second = -1; 
// Add the date components to the start date to get the end date. 
NSDate *endOfNextWeek = [calendar dateByAddingComponents:endOfNextWeekComponents toDate:startOfNextWeek options:NSCalendarMatchStrictly]; 

NSLog(@"%@ - %@", startOfNextWeek, endOfNextWeek); 
0
votes
answers
18 views
+10

Explaining difference between automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout in iOS7

I have been reading a lot about iOS7 UI transition.

I am not able to get what these three properties automaticallyAdjustsScrollViewInsets, extendedLayoutIncludesOpaqueBars, edgesForExtendedLayout??

For example I am trying to make my view controllers start below the status bar but I am not able to achieve it.