我已经按照步骤在xcode中添加自定义字体,每天都是swift和 自定义字体,但是我无法以编程方式在app标签中设置该字体.
var labeladd = UILabel(frame: CGRectMake(40, 50, 70, 22))
// label.center = CGPointMake(160, 284)
/// labeladd.font=UIFont.boldSystemFontOfSize(15)
labeladd.font = UIFont(name:"Source Sans Pro",size:15)
labeladd.textColor=UIColor.blackColor()
labeladd.textAlignment = NSTextAlignment.Center
labeladd.text = "this is custom fonts"
myview.addSubview(labeladd)
Run Code Online (Sandbox Code Playgroud) 我正在做一个安排本地通知并保存userInfo的应用程序.这是好的一部分.
但是当app关闭时,会出现Notification,但是当用户单击时,该方法不会被调用,我无法处理userInfo.
我看到有一种新的方式来接收通知UNUserNotificationCenter.但是也不行.
这是我在AppDelegate中的实现:
@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
let lNotification = UILocalNotification()
lNotification.userInfo = response.notification.request.content.userInfo
applicationWorker.manage(localNotification: lNotification)
}
Run Code Online (Sandbox Code Playgroud)
有人帮我吗?我在这里看到了所有相关的问题,但没有发现任何问题.
谢谢!
编辑:
如果有人正在寻找一个解决方案,我说UNUserNotificationCenter.current().delegate = self在didFinishLaunchingWithOptions和它的工作.
我实现了一个searchController并添加到navigationItem中.
这是代码:
var searchController = UISearchController(searchResultsController: nil)
searchController.obscuresBackgroundDuringPresentation = false
definesPresentationContext = true
searchController.searchResultsUpdater = self
searchController.searchBar.placeholder = NSLocalizedString("Search", comment: "")
searchController.hidesNavigationBarDuringPresentation = true
// Layout
searchController.searchBar.barTintColor = UIColor.groupTableViewBackground
navigationItem.searchController = searchController
Run Code Online (Sandbox Code Playgroud)
当我在searchBar中单击以写入内容时,此警告将显示在控制台中:
NameOfProject [9238:211033] + [CATransaction synchronize]在事务中调用NameOfProject [9238:211033] + [CATransaction synchronize]在事务中调用NameOfProject [9238:211033] + [CATransaction synchronize]在事务中调用NameOfProject [9238:211033] + [在事务中调用的CATransaction synchronize]
拜托,有人知道如何解决这个问题?
提前致谢!!
我正在玩一些设计概念而且我遇到了这个"错误".
知道为什么会这样吗?我已经迭代了不同的东西,仍然无法找到罪魁祸首或解决方案.
价格的这个"圆圈"与其底部的另一个单元重叠是我的预期设计.这一切都很好,但是,当我向下滚动并向后滚动时,"较旧的"单元突然重叠"圆圈".
请看截图.任何帮助深表感谢!!!
有谁之前经历过这个吗?
iOS9 - Xcode 7.3.1
编辑:
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
if let cell = tableView.dequeueReusableCellWithIdentifier("CategoryCell") as? CategoryCell {
cell.selectionStyle = .None
cell.configureCell(dishes[indexPath.row])
return cell
} else {
return UITableViewCell()
}
}
Run Code Online (Sandbox Code Playgroud)
编辑2: 经过进一步分析,我确信这与高度无关?我玩过不同的高度,但仍然得到相同的结果.
问题是,即使在向下滚动时,它也能完美地加载,这一切都很好.直到我向上滚动,这就是问题开始出现的地方.
将Clip SubViews(Cell)设置为true将在加载时剪切所有内容,因此我将其设置为false.
剩下的问题是,如何在向上滚动时处理剪辑?
编辑3: 我想我现在明白了这个问题,但我仍然不太确定如何解决它.
CircleView放置在一个单元格上,该单元格与其下方的另一个单元格重叠.设置clipsToBounds,height或将其置于前面对其下方的单元格没有影响,因为它在向上滚动时离开显示器.
任何人都有一个想法如何以某种方式重新绘制它就像刚刚装载一样(因为onload,事情正在发挥作用)?或者在其他地方是否有一个clipToBounds设置我错过了?
我认为解决方案与此有关:如何阻止UITableView剪辑iOS 7中的UITableViewCell内容
但是,此解决方案不适用于ios9.
我搜索了很长时间,没有答案解决我的问题。
我正在关注有关推送通知的 Firebase 教程并实现了 AppDelegate 代码。
但是 Xcode 无法识别“FIRMessagingDelegate”、“Messaging”和“FIRMessagingRemoteMessage”。
我曾尝试过更新回购、重新创建等。
这是代码:
import UIKit
import CoreData
import Firebase
import UserNotifications
import FirebaseMessaging
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
//FirebaseApp.configure() - Documentação
FIRApp.configure()
if #available(iOS 10.0, *) {
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions, …Run Code Online (Sandbox Code Playgroud)