您好我没有为UITextfield边框颜色更改工作没有错误代码,但在Swift 3中使用它时,不要更改文本字段边框颜色,也不要给出错误.我需要你的帮助,我的代码如下.
@IBOutlet weak var email: UITextField!
@IBOutlet weak var pass: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
let myColor : UIColor = UIColor.white()
email.layer.borderColor = myColor.cgColor
pass.layer.borderColor = myColor.cgColor
}
Run Code Online (Sandbox Code Playgroud)
谢谢 !
什么是archived-expanded-entitlements.xcent文件?在iOS应用程序中使用此文件有什么用?
我试图用来CAShapeLayer掩盖CALayer我的iOS应用程序,因为它需要一小部分CPU time掩盖图像与手动屏蔽一个bitmap context;
当我有几十个或更多图像叠加在一起时,CAShapeLayer蒙面UIImageView很慢移动到我的触摸.
这是一些示例代码:
UIImage *image = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:@"SomeImage.jpg" ofType:nil]];
CGMutablePathRef path = CGPathCreateMutable();
CGPathAddEllipseInRect(path, NULL, CGRectMake(0.f, 0.f, image.size.width * .25, image.size.height * .25));
for (int i = 0; i < 200; i++) {
SLTUIImageView *imageView = [[SLTUIImageView alloc]initWithImage:image];
imageView.frame = CGRectMake(arc4random_uniform(CGRectGetWidth(self.view.bounds)), arc4random_uniform(CGRectGetHeight(self.view.bounds)), image.size.width * .25, image.size.height * .25);
CAShapeLayer *shape = [CAShapeLayer layer];
shape.path = path;
imageView.layer.mask = shape;
[self.view addSubview:imageView];
[imageView release]; …Run Code Online (Sandbox Code Playgroud) 在WWDC 2013的会话220(高级文本布局和带有文本工具包的效果)中,他们明确地说NSLayoutManager可以与创建高级文本动画一起使用NSTextStorage并NSTextContainer创建高级文本动画.他们没怎么说.
我想使用NSLayoutManager/ NSTextStorage/ NSTextContainer来创建自定义文本动画.简单地说,我想为各个字形的大小和位置设置动画,并淡化和解开特定的字形.
似乎没有专门的方法和动画文档,NSLayoutManager我发现的唯一教程就在这里.然而,它展示了如何破解NSLayoutManager动画,而不是如何以它应该使用的方式使用它们(它们CATextLayer为每个单独的字形创建!).
有人能指出我正确的方向吗?我知道如何使用NSLayoutManager/ NSTextStorage/ NSTextContainer来呈现静态文本.一些演示,显示动画文本的原理NSLayoutManager将是完美的.为了让我开始,我可以自己弄清楚细节.
创建自定义UIViewController过渡的最佳方法是什么VC,例如第一个有图像,当你点击它时,它会上升到屏幕的顶部,并添加一些其他UI组件(如标签和textViews)屏幕?
我希望实现Apple在App Store上新的"今天"标签上所做的事情:
知道最好的方法是什么?
谢谢 :)
我是swift的新手,我不知道如何实现本地通知我尝试了一些代码,但这并不完全正常,所以任何人都可以帮助在iOS使用中实现本地通知swift?
导航栏标题有问题.我有2个屏幕,当我点击屏幕2上的后退按钮时它将返回到屏幕1,但屏幕1的标题消失.这是我的代码段
screen1 .m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"title 1";
....
Run Code Online (Sandbox Code Playgroud)
屏幕2 .m
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = self.stringTitle;
// change the back button and add an event handler
self.navigationItem.hidesBackButton = YES;
//set custom image to button if needed
UIImage *backButtonImage = [UIImage imageNamed:@"btn_back.png"];
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button setImage:backButtonImage forState:UIControlStateNormal];
button.frame = CGRectMake(-12, 2, backButtonImage.size.width, backButtonImage.size.height); …Run Code Online (Sandbox Code Playgroud) 有没有办法减少适合单段的字体大小UISegmentedControl?
尝试了很多类似的东西,
[[UILabel appearanceWhenContainedIn:[UISegmentedControl class], nil] adjustsFontSizeToFitWidth];
[[UILabel appearanceWhenContainedIn:[UISegmentedControl class], nil] setMinimumScaleFactor:0.5];
Run Code Online (Sandbox Code Playgroud)
和
NSArray *arr = segment.subviews; // segment is UISegmentedControl object
for (int i = 0; i < arr.count; i++) {
UIView *aSegment = [arr objectAtIndex:i];
for (UILabel *label in aSegment.subviews) {
if ([label isKindOfClass:[UILabel class]]) {
UILabel *myLabel = (UILabel *)label;
[myLabel setNumberOfLines:0];
label.numberOfLines = 0;
label.adjustsFontSizeToFitWidth = YES;
label.minimumScaleFactor = 0.5;
}
}
}
Run Code Online (Sandbox Code Playgroud)
能够设置段标签的行数,如,
[[UILabel appearanceWhenContainedIn:[UISegmentedControl class], nil] setNumberOfLines:0];
Run Code Online (Sandbox Code Playgroud)
可以根据内容设置单段大小,如,
segment.apportionsSegmentWidthsByContent = YES;
Run Code Online (Sandbox Code Playgroud)
但在这种情况下,每个细分市场的规模都不同 …
我有包含日期字符串的数据.
通常它会在'Jan. 1966年3月的'类型格式,但由于国际差异,它可能并不总是那样.
我需要读取数据并将其转换为标准日期字符串('YYYY-MM-DD').
基本上这是我到目前为止:
var dataString = 'Jan. 3, 1966'
var dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = # I DON'T KNOW THE EXACT INPUT FORMAT !
let dateValue = dateFormatter.dateFromString(dataString)
Run Code Online (Sandbox Code Playgroud) ios ×10
swift ×5
objective-c ×3
uilabel ×2
animation ×1
back-button ×1
calayer ×1
cocoa-touch ×1
iphone ×1
masking ×1
nsdate ×1
performance ×1
swift2 ×1
swift3 ×1
textkit ×1
title ×1
uitextfield ×1
xcode ×1