从图中可以看出,标签栏颜色为黑色。我在点击分段控件时隐藏标签栏
@IBAction func segmentedControlTapped(sender: AnyObject) {
if segmentedControl.selectedSegmentIndex == 1 {
self.viewUIPickerView.viewWithTag(10)?.hidden = false
self.viewUIPickerView2.viewWithTag(11)?.hidden = true
}else {
self.viewUIPickerView2.viewWithTag(11)?.hidden = false
self.viewUIPickerView.viewWithTag(10)?.hidden = true
}
self.tabBarController!.tabBar.hidden = true
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用hidesBottomBarWhenPushed = true
仍然不起作用。
我制作了单一视图应用程序并安装了pods.我正在使用Alamofire,SwifttyJSON,HanekeSwift和RealmSwift.在安装之后,我打开.xcworkspace,然后得到这么多错误
我尝试重新安装Pods并删除SwiftyJSON但是出现了另一个错误.我的团队Pods看起来像这样
我怎么解决这个问题?
所以,我正在努力做到这一点:
我尝试在状态栏后面使用UIView并将颜色设置为橙色,但在运行时,UIView显示在状态栏的正下方,所以它仍然是白色
我在互联网上尝试了很多解决方案,但没有一个能够正常工作.是的它有效但当我移动到其他视图控制器并再次返回时,颜色消失了.我该怎么办?我正在使用swift
我有搜索栏和取消按钮,点击搜索按钮后,显示结果但取消按钮无效,我需要点击两次才能使其工作并返回初始结果.如何在搜索结果出现后激活取消按钮?
这是我的代码
func searchBarSearchButtonClicked(searchBar: UISearchBar) {
searchBar.endEditing(true)
searchBar.setShowsCancelButton(true, animated: true)
filterContentForSearchText(searchBar.text!, scope: "All")
print(searchBar.text)
}
func searchBarCancelButtonClicked(searchBar: UISearchBar) {
searchBar.text = ""
searchBar.resignFirstResponder()
searchBar.setShowsCancelButton(false, animated: true)
database = dataUtuh
self.collectionView.reloadData()
}
Run Code Online (Sandbox Code Playgroud)
我已经实现了UISearchBarDelegate
和searchBar.delegate = self
我的viewDidLoad
我创建了一个应用程序,用户可以选择联系人,然后获取姓名、生日和街道地址。我可以获取并显示姓名和生日。但我无法获取街道地址
这是我的代码
@IBOutlet weak var names: UILabel!
@IBOutlet weak var birthday: UILabel!
@IBOutlet weak var address: UILabel!
var storeNames = ""
var storeBirthday = ""
var storeAddress = CNLabeledValue()
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(true)
names.text = storeNames
birthday.text = storeBirthday
address.text = String(storeAddress)
}
func getDateStringFromComponents(dateComponents: NSDateComponents) -> String! {
if let date = NSCalendar.currentCalendar().dateFromComponents(dateComponents) {
let dateFormatter = NSDateFormatter()
dateFormatter.locale = NSLocale.currentLocale()
dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle
let dateString = dateFormatter.stringFromDate(date)
return dateString
}
return nil
}
@IBAction func showContacts(sender: …
Run Code Online (Sandbox Code Playgroud) 我有一个应用程序,用户可以从中选择日期.如何从所选日期设置明天日期.例如,如果用户选择日期24,则打印25,如果用户选择日期31,则打印1.
现在我正在使用当前日期来设置明天的日期
let dates = Date()
var tomorrow: Date {
return Calendar.current.date(byAdding: .day, value: 1, to: Date())!
}
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "dd"
let dateOutDefault = dateFormatter.string(from: tomorrow as Date)
Run Code Online (Sandbox Code Playgroud)
如何使用自定义日期做这样的事情?
如何检测在地图上按下了哪个标记。从API下载的markers数组中,map和class Marker上的标记很少,其中包含一些数据。
例如我有这样的数据
[States(name: "text1", long: 110.42400399999997,lat: -7.0343237999999992),
States(name: "text2", long: 110.42769829999997, lat: -7.0856947999999997),
States(name: "text3", long: 110.42922440000007, lat: -7.3250846999999997),
States(name: "text4", long: 117.11625830000003, lat: -0.50436380000000003),
States(name: "text5", long: 110.43093620000002, lat: -7.0730081999999994)]
Run Code Online (Sandbox Code Playgroud)
如果我点击包含数据的标记1(States(name: "text1", long: 110.42400399999997,lat: -7.0343237999999992)
)
如何获取索引0。如果我点击包含数据2的标记,如何获取索引1?
我有收藏视图,用户可以下载 epub 文件并在下载完成后显示它。我使用 FolioReaderKit 打开 epub 文件,我也得到了正确的路径并且 epub 文件在那里。我正在使用 Alamofire 下载,但是我收到了一堆错误,
2016-11-04 18:02:28.304 indodragon[9482:74592] [SSZipArchive] Error: The file “EPUB.epub” couldn’t be saved in the folder “Documents” because a file with the same name already exists.
2016-11-04 18:02:28.305 indodragon[9482:74592] [SSZipArchive] Error: The file “EPUB.epub” couldn’t be saved in the folder “Documents” because a file with the same name already exists.
2016-11-04 18:02:28.306 indodragon[9482:74592] [SSZipArchive] Error: The file “EPUB.epub” couldn’t be saved in the folder “Documents”.
2016-11-04 18:02:28.320 indodragon[9482:74592] [SSZipArchive] Error: The …
Run Code Online (Sandbox Code Playgroud) 我有以下扩展名
extension Double {
func roundToPlaces(places:Int) -> Double {
let divisor = pow(10.0, Double(places))
return (self * divisor).rounded / divisor
}
}
Run Code Online (Sandbox Code Playgroud)
当我将它更新到Swift 3时,它不起作用.我在这里尝试了解决方案,但我得到了
Binary operator '/' cannot be applied to operands of type '_' and 'Double'
错误
我需要使用视图更改单元格中的图像将出现。但是我不能在视图中使用我的单元格会出现在这里我所做的
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(true)
let cell: HomeCellTableViewCell = self.tableCity.dequeueReusableCell(withIdentifier: "Cell") as! HomeCellTableViewCell
if session == nil {
print("first")
cell.iconForDownload.setImage(UIImage(named: "ic_download"), for: .normal)
} else {
print("second")
cell.iconForDownload.setImage(UIImage(named: "ic_next_green"), for: .normal)
}
}
Run Code Online (Sandbox Code Playgroud)
它打印“第一个”但图像仍然没有改变
在我的cellForRowAt
:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell: HomeCellTableViewCell = self.tableCity.dequeueReusableCell(withIdentifier: "Cell") as! HomeCellTableViewCell
let city = listData[indexPath.row]
cell.labelNameCity.text = city.region
cell.labelNameCityJpn.text = city.regionJpn
let stringImage = config.BASE_URL+city.imgArea
let url = URL(string: stringImage.replacingOccurrences(of: " ", with: …
Run Code Online (Sandbox Code Playgroud) swift ×10
ios ×2
cncontact ×1
cocoapods ×1
epub ×1
google-maps ×1
uisearchbar ×1
uistatusbar ×1