uiviewcontroller

IOS7/IOS8 Allow only portrait in view controller

微笑、不失礼 提交于 2020-01-21 09:15:53
问题 I am building an app for iPhone that will have only 1 landscape view, and so i want to block landscape for all other, i have tried this: -(NSUInteger)supportedInterfaceOrientations { return UIInterfaceOrientationMaskPortrait; } But it stills rotates 回答1: I will suggest to just make your app for portrait mode and then whenever you need the landscape mode then allow landscape mode. First, as previously suggested click on -> Project name -> General -> Deployment Info -> Only select Portrait for

Problems implementing a container view

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 08:40:09
问题 I'm trying to follow the View Controller Programming Guide for iOS to implement a container view in my application. At the moment I'm just trying to get an initial first view to load but the label included in the first controller is not being shown. In the end, I hope to be able to control which view is shown in the container by using a segmented control. Any help would be greatly appreciated. My Storyboard ViewController.h @interface ViewController : UIViewController @property (weak,

View Controller lifecycle on UIModalPresentationOverCurrentContext

匆匆过客 提交于 2020-01-20 05:44:27
问题 How do I determine when the parent view controller has been hidden or shown when I use the UIModalPresentationOverCurrentContext modal presentation style? On normal situations I can use the viewWillAppear: and viewWillDisappear: , but they seem not to be firing on this. 回答1: UIModalPresentationOverCurrentContext is intended to be used to present the content over your current viewController. What that means is, if you have animation or view changes inside your parentViewController, you can

View Controller lifecycle on UIModalPresentationOverCurrentContext

蓝咒 提交于 2020-01-20 05:44:06
问题 How do I determine when the parent view controller has been hidden or shown when I use the UIModalPresentationOverCurrentContext modal presentation style? On normal situations I can use the viewWillAppear: and viewWillDisappear: , but they seem not to be firing on this. 回答1: UIModalPresentationOverCurrentContext is intended to be used to present the content over your current viewController. What that means is, if you have animation or view changes inside your parentViewController, you can

Putting text input from one view to another

£可爱£侵袭症+ 提交于 2020-01-17 08:20:12
问题 I have tried so many tutorials that I am wondering why I am not getting such a simple problem. I have a view controller called SetBudgetViewController. I have a text field in this view that I have connected as an outlet called *amountToSpend. I have another view used elsewhere in the app that has a label called *amountSet. How do I make the numbers entered into the first text field be displayed in the label in the other view? Thank you all so much (this is driving me mad)! 回答1: First, declare

Notification when view controller is presented modally/dismissed?

谁说我不能喝 提交于 2020-01-17 05:16:27
问题 Is there any way to be notified automatically if some view controller is presented modally on top of another view controller (other than viewWillDisappear , which is obviously not called for non-fullscreen modal presentation on iPad)? Background/use case: In an iPad app, whenever a modal form sheet is presented, I want to adjust the appearance of the view behind the modal. However, the presentation if the modals is not necessarily done in the same view controller that needs to adapt, but can

ViewController offset after device rotation in iOS8

此生再无相见时 提交于 2020-01-17 05:16:06
问题 I am experiencing an odd problem with legacy code running in iOS8. The code was originally written pre-iOS6, pre-storyboards (using nibs) and functioned without issue on iOS7. However, strange behavior began to occur when running on iOS8. The app is set to run only in landscape (left or right). Therefore it should support autoRotation from landscape-left to landscape-right. The first problem was that the initial view controller was loaded in portrait and one side was cut off. This issue was

UIView setDelegate:]: unrecognized selector sent to instance

本秂侑毒 提交于 2020-01-17 05:03:30
问题 I am new to IOS, and Trying to pass two values form a UIViewController to a UIView. I followed few examples,some posts, tried and still no luck. I am getting this error while running the application. The error is .. [MenuComponent setDelegate:]: unrecognized selector sent to instance MenuComent is My UIView. FullVC is my UIViewController. FullVC.h @class FullVC; @protocol MenuComponentDelegate <NSObject> -(void)shareToView:(NSString *)titleString inUrl:(NSString *)urlString; @end @interface

How to call (show) another View Controller when clicked on the cell of Table View in Swift

时光怂恿深爱的人放手 提交于 2020-01-17 04:48:04
问题 I'm new in Swift. I want to learn that, how to call another View Controller when the user clicks on cell of Table View. Thanks in advance. 回答1: write following code : func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { self.performSegueWithIdentifier("showItemDetail", sender: tableView)} override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject!) { if segue.identifier == "showItemDetail" { let indexPath:NSIndexPath = self.tableView

UIView class properties seemingly disappear when I call drawRect:

好久不见. 提交于 2020-01-17 04:44:05
问题 I am coding an objective-c project with xcode. I have two important files that are being used: a viewcontroller, and a view. My view is class "PlayingCardView", my viewcontroller is class: "PlayingCardGameViewController". Here is what PlayingCardView.h looks like: #import <UIKit/UIKit.h> @interface PlayingCardView : UIView @property (nonatomic) NSUInteger rank; @property (strong, nonatomic) NSString *suit; @property (nonatomic) BOOL faceUp; @end Here is the important code from PlayingCardView