我正在尝试从左侧而不是右侧进行pushViewController幻灯片,如下所示:
Page14Controller * controller = [[Page14Controller alloc] initWithNibName:@"Page14Controller" bundle:nil];
CATransition* transition = [CATransition animation];
transition.duration = 0.3;
transition.type = kCATransitionPush;
// transition.type = kCATransitionMoveIn;
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
//kCATransitionMoveIn; //, kCATransitionPush, kCATransitionReveal, kCATransitionFade
transition.subtype = kCATransitionFromLeft;
//kCATransitionFromLeft, kCATransitionFromRight, kCATransitionFromTop, kCATransitionFromBottom
[self.navigationController.view.layer addAnimation:transition forKey:nil];
[self.navigationController pushViewController:controller animated:NO];
Run Code Online (Sandbox Code Playgroud)
当我这样做时,当前控制器淡化为白色,这看起来很糟糕.为什么会这样?我已经尝试将当前视图的alpha背景设置为0.
iphone uinavigationcontroller pushviewcontroller catransition ios
我的应用程序有一个带导航栏的tabBar,
tabBar正在显示并正常工作,但是当我想要转到其中一个选项卡中的另一个页面时,它不会加载新页面,
这是我的应用代表
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.tabBarController = [[[UITabBarController alloc] init] autorelease];
StartViewController *startViewControllerView = [[[StartViewController alloc] init] autorelease]; //ojo recomendado por apple!!!
PhotosViewController* PhotosViewController_ = [[[PhotosViewController alloc] init] autorelease];
VideosViewController* VideosViewController_ = [[[VideosViewController alloc] init] autorelease];
SocialViewController* SocialViewController_ = [[[SocialViewController alloc] init] autorelease];
NSArray* controllers = [NSArray arrayWithObjects: startViewControllerView, VideosViewController_, PhotosViewController_, SocialViewController_, nil];
self.tabBarController.viewControllers = controllers;
self.pagesNavigation = [[[UINavigationController alloc] initWithRootViewController:startViewControllerView] autorelease];
self.pagesNavigation.navigationBarHidden = NO;
[self tabBarConfig];
[self.tabBarController setViewControllers:controllers animated:YES];
[self.window addSubview:self.pagesNavigation.view];
self.window.rootViewController = self.tabBarController;
//self.window …Run Code Online (Sandbox Code Playgroud) iphone uitabbarcontroller uinavigationcontroller pushviewcontroller ios
我有一个问题,我有我的第一个视图控制器,当我按下一个按钮与我的主机连接,以检查用户是否已注册..但当我按下按钮时,故事板通过下一个视图,并在检查用户后... .
所以我正在尝试pushViewController与代码,但我不知道如何推动故事板内的视图.
这是代码:http://pastie.org/3025806

我试图用代码推入一个新的视图控制器:
[self.navigationController pushViewController:webViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)
但它不起作用.在表视图中选择单元格时会发生此代码.我有一个表视图,我认为这是防止这种情况发生的.我试过以模态方式呈现它,但摆脱了导航栏,我不能回去.有一个非常类似于此但答案对我不起作用!
UPDATE
- (void)loadView {
// Create an instance of UIWebView as large as the screen
CGRect screenFrame = [[UIScreen mainScreen] applicationFrame];
UIWebView *wv = [[UIWebView alloc] initWithFrame:screenFrame];
// Tell web view to scale web content to fit within bounds of webview
[wv setScalesPageToFit:YES];
[self setView:wv];
[wv release];
}
Run Code Online (Sandbox Code Playgroud)
将Web视图作为WebViewController的视图
如上所示没有笔尖
使用NSLog查询didSelect单元格方法以查找
一切都被初始化和分配,非零
更新:
我做了选择细胞方法:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Push the web view controller onto the navigaton stack - this implicity
// creates the …Run Code Online (Sandbox Code Playgroud) xcode objective-c uitabbarcontroller uinavigationcontroller pushviewcontroller
我有一个以模态方式呈现的viewcontroller.
[self presentModalViewController:ViewControllerA animated:YES];
Run Code Online (Sandbox Code Playgroud)
在这个ViewControllerA中我有一个表视图,当用户点击一个单元格时,另一个ViewControllerB应该被推到当前的一个上面.
- (void)tableView:(UITableView *)tv didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.navigationController pushViewController:ViewControllerB animated:YES];
Run Code Online (Sandbox Code Playgroud)
问题:我无法推送任何东西,因为它是从模态呈现的viewconrtroller推送的.有什么方法可以解决我的问题吗?
我正在尝试根据用户的选择更改视图控制器UIAlertView.我是客观的新手,遇到了麻烦.
当用户按下"我已完成"时,我希望应用程序导航回上一个视图控制器.当用户按下"记分板"时,我希望应用程序导航到下一个视图控制器.
UIAlertView *jigsawCompleteAlert = [[UIAlertView alloc] //show alert box with option to play or exit
initWithTitle: @"Congratulations!"
message:completedMessage
delegate:self
cancelButtonTitle:@"I'm done"
otherButtonTitles:@"Play again", @"Scoreboard",nil];
[jigsawCompleteAlert show];
- (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex {
if (buttonIndex == 0) {
NSLog(@"Cancel Tapped.");
[self.navigationController popViewControllerAnimated:YES];
}
else if (buttonIndex == 1) {
NSLog(@"GO tapped.");
startDate = [NSDate date];
// Create the stop watch timer that fires every 10 ms
stopWatchTimer = [NSTimer
scheduledTimerWithTimeInterval:1.0/10.0
target:self
selector:@selector(updateTimer)
userInfo:nil
repeats:YES];
} else if (buttonIndex == …Run Code Online (Sandbox Code Playgroud) 我正在Swift中开发一个应用程序,它在一个主旨中告诉人们各种货币的比特币价格.要选择货币,用户可以从具有UITableView的视图控制器中的列表中进行选择.这是currencyViewController,它是从我的主屏幕viewController呈现的.
我想要发生的是,当用户解雇currencyViewController时,它会将一个字符串传递给主viewController中的UIButton.
这是应该传递数据的prepareForSegue函数:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) {
if (segue.identifier == "presentCurrency") {
currencySelector.setTitle("\currencySelected", forState: UIControlState.Normal)
}
}
Run Code Online (Sandbox Code Playgroud)
CurrencySelector是主viewController中的UIButton,而currencySelected是第二个视图控制器currencyViewController中的变量.
它给出错误"文字中无效的转义序列"
所以,我把它缩小到两个问题之一:
来自viewController的变量无法从currencyViewController中"看到".如果是这样,我如何从CurrencyViewController修改CurrencySelector的文本?
出于某种原因,当用户退出推送的CurrencyViewControler时,不会调用prepareForSegue.
这里发生了什么?谢谢,道歉 - 我只是一个快速的新手.
这是我第一次尝试使用UINavigationController实现从tableView单元格到另一个tableView的导航,但它对我不起作用.我没有使用nib文件,我有一个简单的tableView,我在我的应用程序中的模态对话框中显示它,它工作正常,现在我将disclosureInidcator添加到其中一个单元格,以使用户启用从固定的选择另一个列表中可用的选项数(tableView).为此,我有另一个类,使第二个tableView.问题是现在从第一个tableview中的单元格(包含泄露图标)导航到第二个tableView没有做任何事情,没有错误,没有什么.我想我设置导航控制器的方式是错误的,代码不属于委托,也不属于第二类的数据源.
在First TableView中的方法:didSelectRowAtIndexPath我试图抓住那一行,然后像这样调用第二个tableView:
mySecondViewController *secondVC = [[[mySecondViewController alloc] initWithStyle:UITableViewStyleGrouped ] autorelease];
UINavigationController *navCont = [[UINavigationController alloc] initWithRootViewController: self];//not sure the first controller should act as the root controller?
[navCont pushViewController:secondVC animated:YES]; //it does nothing, no error,...
Run Code Online (Sandbox Code Playgroud)
第二个tableViewcontroller类包含所有委托和数据源方法,以及初始化方法:
- (id)initWithStyle:(UITableViewStyle)style
{
if ((self = [super initWithStyle:style])) {
}
return self;
}
and declared in interface as:
@interface stockOptionViewController : UITableViewController {
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用viewDidLoad,但没有帮助.
请帮助我,因为我没有线索,找到的所有示例代码都基于使用nib文件.
谢谢,鉴
我有三个控制器,我想知道控制器是推或弹
控制器:
{
if(!b)
b = [B alloc] init];
[self.navigationController pushViewController:b animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
B控制器:
- (void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
//I want here to judge, from the "A" push over, or to return from the "C" "pop"
//if it is push from A
//dosomething.....
//if it is pop from C
//dosomething
}
-(void)testAction:(id)sender
{
C *c = [[C alloc] init];
[self.navigationController pushViewController:b animated:YES];
[c release];
}
Run Code Online (Sandbox Code Playgroud)
C控制器:
{
[self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我在 tableView 单元格中有一个 collectionView。我想点击 collectionView 单元格并使用传入的信息转到 detailTableView。我没有很多工作。做了一些研究,它指出 tableView 单元格既没有故事板也没有导航控制器。我如何能够将数据传递到 detailTableView。这是我的实现,可能不正确
class PopularTableViewCell: UITableViewCell {
var books = [CKRecord]()
var detailViewController: DetailViewController!
}
extension PopularTableViewCell: UICollectionViewDataSource {
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
let record = books[indexPath.row]
let storyBoard = UIStoryboard(name: "Home", bundle: nil)
if let detailVC = storyBoard.instantiateViewController(withIdentifier: "DetailVC") as? DetailViewController {
detailVC.bookRecord = record
detailViewController.navigationController?.pushViewController(detailVC, animated: true)
}
}
}
Run Code Online (Sandbox Code Playgroud) uitableview pushviewcontroller ios uicollectionviewcell swift
ios ×8
iphone ×3
objective-c ×3
swift ×2
uitableview ×2
xcode ×2
catransition ×1
modal-dialog ×1
storyboard ×1
uialertview ×1