草庐IT

ViewController3

全部标签

objective-c - 关闭 Viewcontroller 并执行 segue

我需要使用performSegueWithIdentifier转到另一个ViewController,但我还需要删除我当前所在的ViewController。我该怎么做,我试过这个但它不起作用:[selfperformSegueWithIdentifier:@"next"sender:self];[selfdismissViewControllerAnimated:NOcompletion:nil];//triedtheotherway,butitdoesn'tworkeither[selfdismissViewControllerAnimated:NOcompletion:nil];

ios - -[NSObject(NSObject) doesNotRecognizeSelector :] crash when call -[ViewController prepareForSegue:sender:]

我正在使用Crashlytics来检测我的应用中的崩溃。我偶尔会收到以下崩溃报告。关键的崩溃点是-[NSObject(NSObject)doesNotRecognizeSelector:]和MyViewController.m第596行-[MyViewControllerprepareForSegue:sender:]。我不知道日志中的问题是什么。可能是多线程问题吗?我还使用ParseSDK从Parse云中检索数据。并且prepareForSegue:sender:方法将在用户点击披露指示器时被调用,它应该在主线程中运行。你能给我一些提示来解决这个问题吗?提前致谢。下面是我如何调用pr

iphone - iOS - 如何删除应用程序窗口层次结构中的所有 ViewController?

我的应用程序使用典型的身份验证方案,其中用户使用他的凭据登录服务器,服务器返回一个身份验证token,然后将其存储在本地客户端(iPhone)上。现在存储的身份验证token不太可能但有可能随着时间的推移而失效。由于使用该无效token发出的每个请求都会失败,因此我想在第一次发生该故障时通过“将用户注销”应用程序来处理这个问题。注意:该请求可能在后台线程中发出,因为该应用会定期与服务器同步。注销意味着:删除本地存储的token删除用户存储的所有其他内容(在Sqlite中)将用户“重定向”到登录Controller因此,用户可能正在查看应用内的某些内容,而token变得无效并开始注销过程

iphone - 如何在 iOS 的 ViewController 中的其他 View 下方添加 View ?

在我的应用程序中,我正在创建混合了UILabel和UITextview的ViewController,它们希望可滚动,因为文本是动态的并且也超过垂直屏幕尺寸。我目前有Scrollview,它有如下subview。View是在Xcode4.3Storyboard中创建的。UILabel1(说标题)UITextView1(任意大小的动态文本)UILabel2(第二个标题)UITextView2(任意大小的动态文本)等等。问题是当UITextView1有更多内容时,它会与UILabel2重叠,这是我不想要的。我希望UILabel1位于scrollView之上,UITextView1位于UIL

ios - 同一个 ViewController 中的多个 UICollectionView

我正在使用自定义UICollectionView布局来设置不同大小的单元格,但我无法在其中添加一个部分。在同一个UIViewController中使用多个UICollectionView是个好主意吗?有什么建议吗? 最佳答案 很简单对于每个UICollectionView委托(delegate)-(NSUInteger)maximumNumberOfColumnsForCollectionView:(UICollectionView*)collectionViewlayout:(UICollectionViewLayout*)col

ios - 根 ViewController 内的 UIViewController 不旋转

我有一个UIViewController,我想将它作为一个独立层添加到整个应用程序之上。所以我尝试在应用程序委托(delegate)中使用[self.windowaddSubview:viewController.view]将它添加到UIWindow。但是,当用户旋转设备时,我的ViewController中没有收到willRotateToInterfaceOrientation事件。所以我尝试按照建议做here:我将我的ViewController添加为应用程序委托(delegate)中窗口的RootViewController的subview,但我的willRotateToInte

iOS - 将框架 Storyboard链接到 ViewController 以便在主项目中使用

我正在尝试在我的主项目中使用Storyboard,该项目是在框架中创建的。这是为了在未来的众多不同项目中使用该框架。我已经设法使用bundle将Storyboard提供给主项目,我可以在构建应用程序时看到它。但是,附加的ViewController也位于框架内,在运行时不会链接。框架中的所有类都被导入到主项目中。错误信息说找不到ViewController。我曾尝试将ViewController添加到包中,但它不喜欢这样,因为它不允许将.h文件添加到包中。我也尝试过反转依赖关系,以便框架成为包的依赖项(我认为它会导致其中的所有类,包括我的ViewController,首先加载)。有没有

ios - 添加新的 Viewcontroller 的 View 作为 subview

我正在尝试以下操作,但未能添加新的viewcontrollersView。它是呈现ViewController的唯一方法吗?我们不能从其他StoryboardViewControllerView中添加View吗?//Workingletvc=UIStoryboard(name:"Main",bundle:nil).instantiateViewController(withIdentifier:"customView")as!CustomViewControllerself.present(viewcontroller,animated:true,completion:nil)//No

ios - 将表更改为编辑模式并删除普通 ViewController 中的行

我只是将一个表插入到一个普通的UIViewController中,并将委托(delegate)和源组件与文件的所有者连接起来。当我将数据插入表格行时,一切正常。但现在我正试图找出如何删除行。我只是看了很多其他帖子,但找不到正确的解决方案。我试图为表中的每一行插入一个辅助按钮:cell.accessoryType=UITableViewCellAccessoryDetailDisclosureButton;我什至找到了按下辅助按钮时将调用的方法:-(void)tableView:(UITableView*)tableViewaccessoryButtonTappedForRowWithI

objective-c - 当 ViewController 从 UIStoryboard 实例化时,isMemberOfClass 返回 no

我有一个OCUnit测试类:PatientTestViewControllerTests。下面是界面:@interfacePatientTestViewControllerTests:SenTestCase@property(nonatomic,strong)PatientTestViewController*testController;@end和设置:-(void)setUp{UIStoryboard*storyboard=[UIStoryboardstoryboardWithName:@"Testing"bundle:nil];self.testController=[story