uikit

UIViewController selective Autorotation with Size classes

蓝咒 提交于 2019-12-25 00:05:26
问题 The new size classes based Autorotation is a pain if you want custom behavior. Here are my requirements and flow: View Controller 1(VC1) modally presents View Controller 2 (VC2) VC1 only supports landscape, portrait, or both depending on user settings (achieved via supportedInterfaceOrientations ). For this example, we assume it is locked to landscape, VC 2 supports both landscape & portrait I use Size classes and in View Controller 1, I check for statusBarOrientation in viewWillTransition

How to fix iPhone Simulator trying to launch a Nib that isn't there?

瘦欲@ 提交于 2019-12-24 21:03:51
问题 I'm getting this error message when I Build&Go: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController _loadViewFromNibNamed:bundle:] was unable to load a nib named "TestappViewController"' I created a blank new project and then started to create a RootViewController which holds two other UIViewController's. XCode automatically created the TestappViewController, and I deleted it to start totally from scratch. MainWindow.xib shows me no

warning: passing argument 3 of 'objc_setProperty' as signed due to prototype

我的未来我决定 提交于 2019-12-24 19:24:04
问题 The compiler complains about this, after I activated all kind of warnings: I have an app delegate like this: #import <UIKit/UIKit.h> @class MyViewController; @interface TestAppDelegate : NSObject <UIApplicationDelegate> { UIWindow *window; MyViewController *myViewController; } @property (nonatomic, retain) IBOutlet UIWindow *window; @property (nonatomic, retain) IBOutlet MyViewController *myViewController; @end In the implementation file, I have the synthesize code: @synthesize window;

How to Translate a Delegated Function to a IBAction Function

ⅰ亾dé卋堺 提交于 2019-12-24 11:36:08
问题 I have a delegate function that changes a UITableViewCell's section location on tap: //On cell tap, expand func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) { if indexPath.section == 0 { let data = firstDataSource[indexPath.row] tableView.beginUpdates() secondDataSource.append(data) firstDataSource.removeAtIndex(indexPath.row) let newIndexPath = NSIndexPath(forRow: find(secondDataSource, data)!, inSection: 1) tableView.moveRowAtIndexPath(indexPath,

Cocos2d node over uikit element

為{幸葍}努か 提交于 2019-12-24 11:29:27
问题 I've got a CCScene with few UIKit elements [UITextView for example]. After some user interaction I want to open a popup over the scene to also cover part of the UITextView. It doesn't matter what z index I am using, it will always appear under the text view. Any tips on how to do it? 回答1: Your CCNodes are drawn within the EAGLView Cocos is using. You need to manage the order of EAGLView(s) relative to other UIViews. Take a look at http://www.gdcvault.com/play/1012504/The-Best-of-Both-Worlds

Disadvantages to using CGMutablePathRef?

百般思念 提交于 2019-12-24 11:07:15
问题 I have this code to draw rounded rectangles: void ContextAddRoundedRect(CGContextRef ctx, CGRect rect, CGFloat radius) { CGFloat minX = CGRectGetMinX(rect); CGFloat maxX = CGRectGetMaxX(rect); CGFloat minY = CGRectGetMinY(rect); CGFloat maxY = CGRectGetMaxY(rect); CGContextMoveToPoint(ctx, minX + radius, minY); CGContextAddArcToPoint(ctx, maxX, minY, maxX, minY + radius, radius); CGContextAddArcToPoint(ctx, maxX, maxY, maxX - radius, maxY, radius); CGContextAddArcToPoint(ctx, minX, maxY, minX

iOS7 : UIImageView Takes Forever to Appear

喜夏-厌秋 提交于 2019-12-24 10:54:08
问题 I have a UIView which creates and inserts views using GCD . It's working on iOS7 but the UIImageView s takes forever to show. Here's the sample code that I am using. UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 120)]; for (int i = 0; i < 200; i++) { UIView *view = [[UIView alloc] initWithFrame:CGRectMake(77 * i, 0, 77, 88)]; [scrollView addSubview:view]; dispatch_queue_t queue = dispatch_queue_create("image", NULL); dispatch_async(queue, ^{ UIImageView

Is there any performance or memory overhead using UIImage or UILabel or NSString in Quartz2D

纵然是瞬间 提交于 2019-12-24 10:23:08
问题 Is there any performance or memory overhead using UIImage or UILabel or NSString in Quartz2D . If there is no difference then why not use UIImage , UILabel etc. Can any one send me the snippet how to draw image without using UIImage . Thanks in advance, Regards. please correct me if you see any stupid mistake I am new to this, trying to learn it. 回答1: A label draws a string. You can't have a label without a string; if you did, what would it draw? Last I checked, UILabel uses UIWebView

Mirroring UIView

雨燕双飞 提交于 2019-12-24 09:59:10
问题 I have a UIView with a transparent background, and some buttons. I would like to capture the drawing of the view, shrink it, and redraw (mirror) it elsewhere on the screen. (On top of another view.) The buttons can change, so it isn't static. What would be the best way to do this? 回答1: Check a nice sample code http://saveme-dot-txt.blogspot.com/2011/06/dynamic-view-reflection-using.html following WWDC sessions. It uses CAReplicatorLayer for reflection, pretty easy to implement and looks

Returning image with threading in iOS

Deadly 提交于 2019-12-24 09:18:17
问题 Hi I'm working through the Stanford iOS development class. I have a question regarding threading. I understand UIKit calls should be handled by the main thread. I was wondering if something like this is legal? - (UIImage *)mapViewController:(MapViewController *)sender imageForAnnotation:(id<MKAnnotation>)annotation { FlickrPhotoAnnotation *fpa = (FlickrPhotoAnnotation *) annotation; NSURL *url = [FlickrFetcher urlForPhoto:fpa.photo format:FlickrPhotoFormatSquare]; __block UIImage *image;