uikit

UITableViewController auto-scrolling stops taking into account keyboard when shown from a UISplitViewController

你说的曾经没有我的故事 提交于 2019-12-12 10:51:53
问题 When you subclass UITableViewController , you normally get certain behaviors "for free". For example, when a text field in your table view becomes first responder, the view controller automatically scrolls itself to ensure the field is fully visible. However, when the table view controller is the detail view controller of a UISplitViewController , this auto-scrolling no longer takes into account the presence of the keyboard. The table view controller will still auto-scroll to keep the text

Swift: Error when trying to import UIKit

青春壹個敷衍的年華 提交于 2019-12-12 10:49:23
问题 I'm getting this really weird error when trying to import UIKit in my swift file. My Code is simply: import UIKit class Test: NSObject { } The error I get at 'import UIKit' is: Unknown type name 'import' Expected ';' after top level declarator I have added UIKit to my Frameworks folder, the class doesn't contain any code (so therefore there shouldn't be anything wrong with it) and I tried to restart both xCode and my Mac, but the error is still there. I appreciate any help. Thanks. EDIT:

UIButton vertical alignment doesn't work

二次信任 提交于 2019-12-12 10:47:44
问题 I can't figure why in the following code, the title alignment isn't remain Top. UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeRoundedRect]; btn2.titleLabel.font = [UIFont systemFontOfSize:53]; btn2.frame = CGRectMake(20, 20, 270, 44); [btn2 setTitle:@"test1 test2 test3 test4 test5 test6 test7" forState:UIControlStateNormal]; [btn2 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; btn2.titleLabel.minimumFontSize = 1.0; btn2.titleLabel.adjustsFontSizeToFitWidth = YES;

Convert UIKit coordinates to SpriteKit coordinates

风格不统一 提交于 2019-12-12 10:47:12
问题 I am trying to convert normal uikit coordinates (top left origin, width and height go right and down) to Sprite Kit coordinates (origin is at center of node, left and down are negative, right and up are positive). Does anyone know how to do this? Unfortunately I can't work around this to my knowledge because I am using QuartzCore for drawing on a SKNode. Without converting, I am getting really off drawings. 回答1: According to the docs, SKView has methods for Converting Between View and Scene

Round corners UIView or UIImageView

佐手、 提交于 2019-12-12 10:36:14
问题 I need to add Round corners to a UIImageView . I found a solution from a forum, and i tried the following code; UIImageView * roundedView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wood.jpg"]]; // Get the Layer of any view CALayer * l = [roundedView layer]; [l setMasksToBounds:YES]; [l setCornerRadius:10.0]; I am using iOS 5, and setMasksToBounds:YES and setCornerRadius are not found. So is there any other way i could get round corners in my UIImageview ? 回答1: To make rounded

Why are UIFont and CGFont/CTFont separated completely?

感情迁移 提交于 2019-12-12 10:33:26
问题 I was trying to draw some text with a downloaded font. I looked at API documentation and searched the Web. I found a solution, but the problem is that it's applicable to only the CoreGraphics level framework. So I searched for a way to convert CGFont to UIFont , but there was no way to do this. I realized UIFont and CGFont/CTFont are separated completely, even though they're created from same font file. CGFont and CTFont are convertible from/to each other, but for UIFont , the only way is

How to implement scrollViewDidScroll in UIScrollView

最后都变了- 提交于 2019-12-12 09:41:40
问题 I'm having a problem where when I call the scrollViewDidScroll method in my subclass of UIScrollView nothing happens. Here is my code: AppDelegate.m #import "ScrollView.h" - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. CGRect screenRect = [[self window] bounds]; ScrollView *scrollView = [

How can you make a UIView with rounded top corners and square bottom corners

无人久伴 提交于 2019-12-12 09:37:18
问题 I am trying to get a view with rounded top corners and square bottom corners, similar to the top row of a grouped UITableViewCell. Anyone one know an easy way to draw it and not use a background image? 回答1: I read this post a while ago: Just two rounded corners? and also this follow-up post: Round two corners in UIView I think these should answer your question. 回答2: Swift 4: For iOS 11 onwards override func viewDidLoad() { super.viewDidLoad() if #available(iOS 11.0, *) { self.viewToRound

What does that mean? “mi_cmd_stack_list_frames: Not enough frames in stack.”

耗尽温柔 提交于 2019-12-12 09:36:32
问题 Debugger is telling me this, when I run my app on device: Program received signal: “EXC_BAD_ACCESS”. mi_cmd_stack_list_frames: Not enough frames in stack. mi_cmd_stack_list_frames: Not enough frames in stack. I don't get information about where in code that happens. That's all I get. Any idea what that could mean? The app crashes after that. When the device is not connected to the mac, it still crashes, so not a debugger problem. 回答1: Building on the 4.0 sdk onto a 3.1.3 phone caused this for

Navigation Bar Button

这一生的挚爱 提交于 2019-12-12 09:25:21
问题 When I am putting two right bar buttons in my navigation bar at that time those two buttons are visible but they have a top border means I don't want that border. I am creating those buttons in my frame and assigning that frame to the navigation bar. How do I hide that frame border? My code is as below: UIBarButtonItem *btnAdd = [[UIBarButtonItem alloc] initWithTitle:@"Add" style:UIBarButtonItemStyleBordered target:self action:@selector(Add)]; UIBarButtonItem *btnEdit = [[UIBarButtonItem