我在从api请求数据时遇到此错误.我想要的只是获取消息"请求超时".在NSLocalizedDescription.怎么做到的?下面是返回错误.
错误域= NSURLErrorDomain代码= -1001"请求超时." UserInfo = 0xa5bd490 {NSErrorFailingURLStringKey = api url,NSErrorFailingURLKey = api url,NSLocalizedDescription =请求超时.,NSUnderlyingError = 0xa5763b0"请求超时."}
在采用新的时候,UISplitViewController我试图将更改作为使用UISplitViewControllerDisplayModeAutomatic模式时发生的默认行为.
在纵向工作时,我希望在用户触发推送到细节侧时隐藏主要叠加层.默认情况下,覆盖图保持在屏幕上,直到用户点击细节一侧.
我已尝试将以下内容与委托人一起使用:
- (BOOL)splitViewController:(UISplitViewController *)splitViewController showDetailViewController:(UIViewController *)vc sender:(id)sender
{
if (splitViewController.displayMode == UISplitViewControllerDisplayModePrimaryOverlay) {
[UIView animateWithDuration:0.3 animations:^{
splitViewController.preferredDisplayMode = UISplitViewControllerDisplayModePrimaryHidden;
}];
}
return NO;
}
Run Code Online (Sandbox Code Playgroud)
这给了我在肖像中所需的行为,但这打破了横向模式(我想表现得像UISplitViewControllerDisplayModeAllVisible).如果您已完成推动然后旋转设备,则左侧仍然是隐藏的(如预期的那样).我无法找到一个appriprite地方来重新设置旋转的首选模式以显示左侧(因为特征集合不能用于告诉iPad上的风景与肖像).
如何手动触发覆盖的解雇?
Dupe注意: iOS8已经UISplitViewController完全改变了,所以在2014年 6月之前所有其他的SO答案都可能是错误的(我已经挖掘了很多,只是因为)
uisplitviewcontroller screen-rotation ios ios-universal-app ios8
大家好我是swift的新手,在我的应用程序中我声明了这样的字典:
var imageDict : Dictionary<String, String> = [:]
Run Code Online (Sandbox Code Playgroud)
我想像这样设置该字典的值:
imageDict.setValue(NSStringFromCGPoint(frame), forKey: NSString.stringWithString("/(tagValue)"));
Run Code Online (Sandbox Code Playgroud)
但我得到这样的错误:
Dictonary <String, String> does not have a member named 'setValue'
Run Code Online (Sandbox Code Playgroud)
这个问题来自我之前的问题,并且可以通过enybody解释为什么我无法为该词典设定价值,并且enybody能告诉我其他任何方式吗?
提前致谢.
我是Swift的新手,在Objective-C知识量表上大约有五分之一的人.
我创建了一个基本的三个标签Swift应用程序.每个选项卡都有一个关联的swift类文件,例如FirstViewController.swift,SecondViewController.swift,ThirdViewController.swift.
当我选择第三个选项卡时,我现在使用ThirdViewController.swift中的viewDidAppear函数覆盖打开应用程序首选项设置,例如:
override func viewDidAppear(animated: Bool) {
// open app preference s
if let url = NSURL(string:UIApplicationOpenSettingsURLString) {
UIApplication.sharedApplication().openURL(url)
}
}
Run Code Online (Sandbox Code Playgroud)
但是,在打开首选项之前,我想将活动选项卡设置回第一个选项卡.如何在Swift中优雅地完成这项工作.
以下不起作用:
self.tabBarController.selectedIndex = 0
Run Code Online (Sandbox Code Playgroud)
由于UIViewController该的ThirdViewController类没有一个tabBarController.
布莱恩.
我正在使用AVSpeechSynthesizer单身人士.在iOS 8中,当应用程序被搁置一段时间后,当它恢复时,AVSpeechSynthesizer单身人士将不再说话.iOS 7上不会发生此问题.
当应用程序变为后台时,我的日志中会显示以下消息:
AVSpeechSynthesizer Audio interruption notification: {
AVAudioSessionInterruptionTypeKey = 1;
}
Run Code Online (Sandbox Code Playgroud)
我AVSpeechSynthesizer用singleton的init方法初始化了这个:
self.speechSynthesizer = [[AVSpeechSynthesizer alloc] init];
self.speechSynthesizer.delegate = self;
Run Code Online (Sandbox Code Playgroud)
我说的utterance是这样的:
AVSpeechUtterance *utt = [[AVSpeechUtterance alloc] initWithString:dialogue];
utt.voice = [AVSpeechSynthesisVoice voiceWithLanguage:voice];
utt.pitchMultiplier = pitch;
utt.rate = rate;
utt.preUtteranceDelay = preDelay;
utt.postUtteranceDelay = postDelay;
utt.volume = volumeSetting;
[self.speechSynthesizer speakUtterance:utt];
Run Code Online (Sandbox Code Playgroud)
iOS 8上有没有人见过这样的东西?
我想更改导航栏中的字体.但是,以下代码不起作用,它会导致应用程序崩溃.
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
UINavigationBar.appearance().titleTextAttributes = [NSFontAttributeName: UIFont(name: "Lato-Light.ttf", size: 34)!]
return true
}
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
致命错误: unexpectedly found nil while unwrapping an Optional value(lldb)
我确实已将字体Lato-Light.ttf添加到我的项目中,因此它应该能够找到它.
UITableView对于iOS和我的数组内容超过500个元素,我很生气.
如何UITableView为示例创建页面:
一旦用户滚动最新Cell的应用程序加载更多的500元素,依此类推.
任何帮助?
谢谢.
尝试使用NSURL下面的类时出错,下面的代码实际上是试图将我从Facebook拉入的图像存储到imageView.错误如下:
value of optional type 'NSURL?' not unwrapped, did you mean to use '!' or '?'
Run Code Online (Sandbox Code Playgroud)
不知道为什么会这样,帮忙!
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var myImage: UIImageView!
override func viewDidLoad() {
super.viewDidLoad()
let myProfilePictureURL = NSURL(string: "http://graph.facebook.com/bobdylan/picture")
let imageData = NSData(contentsOfURL: myProfilePictureURL)
self.myImage.image = UIImage(data: imageData)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
Run Code Online (Sandbox Code Playgroud) 我正在为iOS开发一个社交媒体应用程序
我ViewControllers目前已经嵌入了NavigationController.在我的新闻提要屏幕上,我需要在用户向下滑动时显示搜索栏(并在他向上滑动时隐藏它),其中如果用户输入内容,搜索结果将显示在新闻提要屏幕的顶部.
我试图修补这个,但我对iOS很新,到目前为止还没有设法让它工作.
任何帮助将grately理解和记住,我只几个星期的编程的iOS这样一些深层次的将是有益的.谢谢 !
我想要做的就是隐藏一个按钮,直到按下另一个按钮.
例如,按钮1可见,但按钮2不可见.当我按下按钮1时,我需要按钮2出现.
另外,我使用Swift在Xcode 6中编程.
提前致谢!
swift ×7
ios ×6
ios8 ×2
button ×1
fonts ×1
ios7 ×1
nserror ×1
nsurl ×1
paging ×1
scroll ×1
storyboard ×1
uisearchbar ×1
uitableview ×1
xcode ×1
xcode6 ×1