UIAlertController 显示小字符串。当字符串的大小变大时。那么此警报中的一些文本丢失了。是否有任何滚动功能可以滚动到剩余的文本?
var alert = UIAlertController(title: "title here", message: "about 30 line text here", preferredStyle: UIAlertControllerStyle.Alert)
alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.Default, handler: nil))
self.presentViewController(alert, animated: true, completion: nil)
Run Code Online (Sandbox Code Playgroud)
如何制作一个警报,显示大于 30 行的文本。我用的是迅捷。
我注意到手动创建 .ipa 文件xcrun与从 xcode 导出它有所不同。该xcrun版本的 .ipa 中不包含任何符号。
我想知道从命令行手动创建带有符号(没有理由不发送它们)的 .ipa 的最佳方法是什么,我正在使用 TeamCity CI 生成我们的生产 .ipa 文件。
我使用以下命令行生成 IPA -
/usr/bin/xcrun -sdk iphoneos PackageApplication -v "DerivedData/MyApp/Build/Products/Release-iphoneos/MyApp.app" -o "~/MyApp.ipa" --sign "<HIDDEN>" --embed "<HIDDEN>"
Run Code Online (Sandbox Code Playgroud)
我在调用后运行它,xcodebuild以便该Release-iphoneos文件夹获得我的应用程序的最新发行版本。
我在这里遇到一些麻烦......
我如何将这段代码转换为Swift:
imageView.layer.shadowPath = [UIBezierPath bezierPathWithRect:yourImageView.bounds].CGPath;
Run Code Online (Sandbox Code Playgroud) 我试图在iOS 8的UIStoryboard中使用swift创建自定义标签栏控制器(objective-c也没关系).所以,我计划使用这段代码.
let item0: UITabBarItem = UITabBarController().tabBar.items[0] as UITabBarItem
item0.setFinishedSelectedImage(selectedImage0, withFinishedUnselectedImage: unselectedImage0)
Run Code Online (Sandbox Code Playgroud)
但是,问题是setFinishedSelectedImage不再支持,我看到了这个错误.我该如何实施?
从iOS 7及更早版本开始不推荐使用的API在Swift中不可用
var searchDelayer:NSTimer?
func searchBar(searchBar: UISearchBar!, textDidChange searchText: String!) {
searchDelayer?.invalidate()
searchDelayer = nil
searchDelayer = NSTimer.scheduledTimerWithTimeInterval(1.5, target: self, selector: Selector("doDelayedSearch:"), userInfo: searchText, repeats: false)
}
func doDelayedSearch(text:String){
...
}
Run Code Online (Sandbox Code Playgroud)
为什么此代码崩溃并显示错误消息:
[__NSCFTimer copyWithZone:]: unrecognized selector sent to instance
Run Code Online (Sandbox Code Playgroud)
更新:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFTimer copyWithZone:]: unrecognized selector sent to instance 0x7f9c622ae7e0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010c05b3e5 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x000000010ba42967 objc_exception_throw + 45
2 CoreFoundation 0x000000010c0624fd -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 …Run Code Online (Sandbox Code Playgroud) 在iOS 8,代码崩溃后添加图像UIActionSheet's _button valueForKey.
UIActionSheet *action = [[UIActionSheet alloc ] initWithTitle:@"Choose Action!" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Start Auto Scroll", nil];
[[[action valueForKey:@"_buttons"] objectAtIndex:0] setImage:[UIImage imageNamed:@"autoScroll.png"] forState:UIControlStateNormal];
[action showInView:self.view];
Run Code Online (Sandbox Code Playgroud)
崩溃日志是
*** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<UIActionSheet 0x7ff6d8c61030> valueForUndefinedKey:]: this class is not key value coding-compliant for the key _buttons.'
Run Code Online (Sandbox Code Playgroud)
我怎么解决呢?
我曾经使用下面的代码更改我的应用程序的标题属性(font,textColor等)或Nativgation Bar:
[[UINavigationBar appearance] setTitleTextAttributes:
[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor], UITextAttributeTextColor, nil]];`
Run Code Online (Sandbox Code Playgroud)
今天我注意到在iOS8 GM Seed上,textColor没有变化,仍然是黑色.
如果有人遇到过类似的问题并得到解决,那么非常感谢.
我要求用户使用Touch Id进行身份验证(在iOS 8上)."触摸ID"对话框显示在另一个视图上方,该视图将在"输入密码"或"取消"按钮的情况下接收用户输入,而不是用户使用指纹进行身份验证.
如果成功 - 我正在弹出视图控制器.在"取消"或"输入密码"的情况下,我让用户输入密码,然后(如果密码正确) - 我正在弹出视图控制器.
如果用户手动输入密码,则会立即弹出视图.如果用户正在使用指纹 - 立即调用弹出代码(根据调试器和打印到控制台的NSLog) - 但UI在大约5秒后显示弹出.
可能是什么问题呢?
我有一张桌子.表有1个简单的自定义单元格.此单元格中只有标签.这是cellForRow函数的代码:
MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.myLabel.text = [NSString stringWithFormat:@"%ld", (long)indexPath.row];
cell.myLabel.frame = CGRectOffset(cell.myLabel.frame, 0, -20);
cell.myLabel.backgroundColor = [UIColor redColor];
return cell;
Run Code Online (Sandbox Code Playgroud)
一切正常,除了这个:
cell.myLabel.frame = CGRectOffset(cell.myLabel.frame, 0, -20);
Run Code Online (Sandbox Code Playgroud)
标签不想动!我在iOS8中发现了这个问题.
有人帮忙请:)
我正在开发的应用程序将在用户给出特定时间后播放歌曲,例如34分钟后.我不希望有必要让应用程序打开,我希望它可以退出应用程序.我面临的问题是,当锁定手机或只是按主屏幕时,NSTimer不起作用.我在网上搜索过,但我没有找到任何适用于Swift和iOS 8的解决方案.
ios8 ×10
ios ×6
swift ×5
iphone ×2
nstimer ×2
cell ×1
objective-c ×1
uistoryboard ×1
uitableview ×1
xcode ×1
xcode6 ×1
xcrun ×1