I'm trying to localize my app using NSLocalizedString. When i import the XLIFF file, most works like a charm but something do not and some string is not localized. I have noticed that the problem is from NSLocalizedString containing something variable inside like:
NSLocalizedString(" - \(count) Notifica", comment: "sottotitolo prescrizione per le notifiche al singolare")
Run Code Online (Sandbox Code Playgroud)
or
NSLocalizedString("Notifica per \(medicina!) della prescrizione \(prescription!)\nMemo: \(memoTextView.text)", comment: "Messaggio della Local Notification")
Run Code Online (Sandbox Code Playgroud)
Maybe this is not the correct syntax for thi kind of stuff. …
我有一个带文本字段和两个按钮的AlertController:CANCEL和SAVE.这是代码:
@IBAction func addTherapy(sender: AnyObject)
{
let addAlertView = UIAlertController(title: "New Prescription", message: "Insert a name for this prescription", preferredStyle: UIAlertControllerStyle.Alert)
addAlertView.addAction(UIAlertAction(title: "Cancel",
style: UIAlertActionStyle.Default,
handler: nil))
addAlertView.addAction(UIAlertAction(title: "Save",
style: UIAlertActionStyle.Default,
handler: nil))
addAlertView.addTextFieldWithConfigurationHandler({textField in textField.placeholder = "Title"})
self.presentViewController(addAlertView, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是在文本字段为空时执行检查以禁用SAVE按钮,就像想要创建NewAlbum的iOS的图片应用程序一样.请有人能解释一下该怎么办?
我已经使用故事板为我的View Controller实现了一个导航控制器.现在我想用属性检查器更改导航栏标题字体和大小,但它不起作用,我不明白为什么.标题颜色更改但字体不.
ps:颜色更改仅在运行时可见,而不在故事板中可见.
我有一个带有文本字段和textview的表视图.我已经实现了这个代码,就像这个苹果示例代码https://developer.apple.com/library/ios/documentation/StringsTextFonts/Conceptual/TextAndWebiPhoneOS/KeyboardManagement/KeyboardManagement.html所建议的那样.
@IBOutlet var myTableView: UITableView
func keyboardWasShown (notification: NSNotification)
{
println("keyboard was shown")
var info = notification.userInfo
var keyboardSize = info.objectForKey(UIKeyboardFrameBeginUserInfoKey).CGRectValue().size
myTableView.contentInset = UIEdgeInsetsMake(0, 0, keyboardSize.height, 0)
myTableView.scrollIndicatorInsets = myTableView.contentInset
}
func keyboardWillBeHidden (notification: NSNotification)
{
println("keyboard will be hidden")
myTableView.contentInset = UIEdgeInsetsZero
myTableView.scrollIndicatorInsets = UIEdgeInsetsZero
}
override func viewDidLoad() {
super.viewDidLoad()
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWasShown:", name: UIKeyboardDidShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillBeHidden:", name: UIKeyboardWillHideNotification, object: nil)
}
Run Code Online (Sandbox Code Playgroud)
当我点击滚动视图的"文本"时,就在屏幕顶部上方,但是当我松开键盘时,它仍然向上滚动.这就像第一次使用后无法修改insets属性一样.我的错是什么?
使用Xcode的beta 3,以下代码不再起作用:
func keyboardWasShown (notification: NSNotification)
{
var info = notification.userInfo
keyboardSize = info.objectForKey(UIKeyboardFrameBeginUserInfoKey).CGRectValue().size
}
Run Code Online (Sandbox Code Playgroud)
在指示:
keyboardSize = info.objectForKey(UIKeyboardFrameBeginUserInfoKey).CGRectValue().size
Run Code Online (Sandbox Code Playgroud)
XCode返回错误[NSObject:AnyObject]没有名为objectForKey的成员.
所以我改变了这样的代码:
func keyboardWasShown (notification: NSNotification)
{
var info = notification.userInfo
keyboardSize = info[UIKeyboardFrameBeginUserInfoKey].CGRectValue().size
}
Run Code Online (Sandbox Code Playgroud)
但是XCode返回错误"String不是子类型f DictionaryIndex"
我找了一个解决方案,但我一无所获.与XCode 6的beta 3一样,我的代码不再起作用了.Xcode将此错误返回给我:
在/Users/Marco/Desktop/iPrescription/iPrescription/MedicineTableViewController.swift:109:14:0发出'tableView'的SIL时:错误:无法执行命令:分段错误:11:0:错误:swift前端命令失败到期发信号(使用-v查看调用)命令/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift失败,退出代码为254
我是ios编程的新手,我不知道如何找到这个问题的根源.我非常沮丧,因为我不知道在寻找什么.
是否有可能使用语义UI卡左侧有图像?文档显示了图像始终位于顶部的示例.我想要获得的是类似语义UI项目(当然我想要使用卡片),如下所示:
我想要获得的是这样的:
正如您所看到的,图像位于左侧,它类似于语义UI卡.
我的故事板上有这个视图层次结构:
UITabBarController
-> UIView
+ ContainerController
-> SplitViewController
=> [主:( UINavigationController
-> UITableviewController
-> UITableViewController
),细节:( UINavigationController
-> UIView
)]
这是故事板的屏幕截图:
因此,我的细节视图控制器与底部屏幕有某种偏移,如下一个屏幕中的红色圆圈所示:
我认为这是在容器控制器中有一个拆分视图控制器的结果,它嵌入在选项卡控制器中。这就像详细视图继承了根标签栏控制器的标签栏的空间。我试图设置所有选项,例如UnderBottombar或“Under opaque bar”,但什么也没设置。我已经在我的课程中删除了任何类型的自定义代码,但始终存在相同的问题。我该如何解决这个问题?
ps:抱歉英语不好:)
uitabbarcontroller uiviewcontroller uisplitviewcontroller ios uicontainerview
我是 iOS 开发新手,我正在寻找一种解决方案来比较两个 String 忽略开头或结尾的空格。例如, "Hello" == "Hello " 应该返回 true。
我已经搜索了一个解决方案,但我在 Swift 中什么也没找到。谢谢
我不明白为什么当我尝试设置UILocalNotification的userinfo字典时,XCode返回错误"'@lvalue $ T7'与(NSObject,AnyObject)'"不同.这是样本:
var medicine: String?
var notification = UILocalNotification()
notification.userInfo["medicine"] = medicine
Run Code Online (Sandbox Code Playgroud)
这不是我第一次遇到字典问题.我不明白苹果用xcode 6 beta 3改变了什么.
我尝试过很多演员,但我无法理解这是什么问题.
我有一个用storyboard创建的UITableviewController.现在我想改变表视图的X和Y坐标(具体来说我想在表视图中放一点).在storyboard中有一个选项,我可以设置此参数或更改tableview大小?我找不到它
我已经尝试查看尺寸检查器,但看起来X和Y参数被禁用.
ios ×10
swift ×7
xcode ×4
dictionary ×2
uitableview ×2
alert ×1
css ×1
fonts ×1
keyboard ×1
localization ×1
nsstring ×1
semantic-ui ×1
spaces ×1
storyboard ×1
string ×1
tableview ×1
uiscrollview ×1
uistoryboard ×1
xcode6 ×1
xliff ×1