this is the screen shot of storyboard
我正在使用myList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
def organizeList(li):
finalList = []
sortList = li
sortList.sort()
for x in range(len(li)):
pop = sortList.pop()
if len(finalList) % 2 == 0:
finalList.append(pop)
else:
finalList.insert(0, pop)
return finalList
print(myList) # Returns [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
print(organizeList(myList)) # Returns [1, 3, 5, 7, 9, 10, 8, 6, 4, 2]
print(myList) # Returns []
并尝试使用此代码推送其他视图控制器:
SWRevealViewController
它运行良好,但我无法将该视图控制器弹出到以前的视图控制器.. 我使用了所有基本的popViewcontrollers代码仍然无法正常工作。 我只是想不出来该怎么做。 请任何机构有诀窍请做什么回复请.. 提前谢谢....
答案 0 :(得分:0)
请使用pushFrontViewController:代替setFrontViewController:
代码是这样的:
[revealController pushFrontViewController:frontController animated:YES];
它可能对您有所帮助。
之后,您可以从视图控制器弹出。
答案 1 :(得分:0)
您可以使用以下代码
将应用导航到其他viewControllersUIStoryboard *mainStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
// here you need to create storyboard ID of perticular view where you need to navigate your app
UIViewController *vc = [mainStoryboard instantiateViewControllerWithIdentifier:@"viewContIdentifire"];
// if use presentViewController this will not enables you to go back to previous view
[self presentViewController:vc animated:NO completion:nil];
**// OR**
// using pushViewController lets you to go back to the previous view
[self.navigationController pushViewController:vc animated:YES];
注意:使用其中一种方法presentViewController
或pushViewController
进行导航。
根据popToRootViewControllerAnimated
堆栈使用popToRootViewControllerAnimated
,popToRootViewControllerAnimated
和UI
方法处理回弹。
// this takes your app to the root view controller
[self.navigationController popToRootViewControllerAnimated:YES];
// this will takes you to the previous view loaded in stack
[self.navigationController popToRootViewControllerAnimated:YES];
// this takes to any view controller, use accordingly
[self.navigationController popToViewController:yourViewControllerName animated:YES];