我没有运气得到一个图像,它UIImageView在我的自定义中显示正确的大小UITableViewCell. 图像是正确的,但它的位置UITableViewCell不是,甚至不是很接近.
我没有足够的声望点来悲伤地发布图像.
我有Xcode 6添加或建议的所有建议约束,但是图像显示在我的所有内容中UITableViewCell.
这是我唯一与之相关的代码.
ViewController.m
self.tableView.rowHeight = UITableViewAutomaticDimension;
self.tableView.estimatedRowHeight = 600.0;
NSString *imageURL = [NSString stringWithFormat:@"%@", standardResolutionLocal.url];
__weak UITableViewCell *wcell = api2Cell;
[wcell.imageView
sd_setImageWithURL:[NSURL URLWithString:imageURL]
placeholderImage:[UIImage imageNamed:@"320x180.gif"]
];
Run Code Online (Sandbox Code Playgroud)
CustomTableViewCell.m
- (void)layoutSubviews {
[super layoutSubviews];
[self.imageViewPic setTranslatesAutoresizingMaskIntoConstraints:YES];
}
Run Code Online (Sandbox Code Playgroud)
我通过CocoaPods使用iOS 8,Xcode 6和SDWebImage.任何帮助将不胜感激,谢谢!
我将数据从iOS传递到WatchKit. 我无法得到数据显示在WatchKit方面收到的某种方式.
这很好用:iOS TableViewController
func getCloudKit() {
///...
let publicData = container.publicCloudDatabase
publicData.performQuery(query, inZoneWithID: nil) { results, error in
if error == nil { // There is no error
for play in results! {
let newPlay = Play()
newPlay.tColor = play["TColor"] as! String
do {
try WatchSessionManager.sharedManager.updateApplicationContext(["color" : newPlay.tColor])
NSLog("NewPColor: %@", newPlay.tColor)
} catch {
print(error)
}
self.objects.append(newPlay)
}
} else {
print(error)
}
}
}
Run Code Online (Sandbox Code Playgroud)
这不是调用任何NSLogs或显示任何数据:WatchKitInterfaceController
import WatchConnectivity
class InterfaceController: WKInterfaceController, WCSessionDelegate {
@IBOutlet var …Run Code Online (Sandbox Code Playgroud) 我所有的数据创建都是在ExtensionDelegate.swift.
该问题ExtensionDelegate.swift没有得到该功能之前叫getCurrentTimelineEntryForComplication我的ComplicationController.swift。
有任何想法吗? 这是我的代码和详细信息:
所以我的数组extEvnts是空的ComplicationController.swift:
func getCurrentTimelineEntryForComplication(complication: CLKComplication, withHandler handler: ((CLKComplicationTimelineEntry?) -> Void)) {
let extEvnts = ExtensionDelegate.evnts
}
Run Code Online (Sandbox Code Playgroud)
因为 myExtensionDelegate.swift还没有被调用,这就是为数组创建数据的原因:
class ExtensionDelegate: NSObject, WKExtensionDelegate, WCSessionDelegate {
private let session = WCSession.defaultSession()
var receivedData = Array<Dictionary<String, String>>()
static var evnts = [Evnt]()
func session(session: WCSession, didReceiveUserInfo userInfo: [String : AnyObject]) {
if let tColorValue = userInfo["TeamColor"] as? String, let matchValue = userInfo["Matchup"] as? String { …Run Code Online (Sandbox Code Playgroud) 这个计时器并不是每秒触发一次,当我检查日志和 UI 时,它似乎每 3-4 秒触发一次。
func startTimer() {
print("start timer")
timer = Timer.scheduledTimer(timeInterval: 1,
target: self,
selector: #selector(timerDidFire),
userInfo: nil,
repeats: true)
}
func timerDidFire(timer: Timer) {
print("timer")
updateLabels()
}
Run Code Online (Sandbox Code Playgroud)
这只是由于缺乏功能而在手表上发生的事情,还是我的代码有问题?
如果需要的话,这是日志:
0.0396000146865845
3.99404102563858
7.97501903772354
11.9065310359001
Run Code Online (Sandbox Code Playgroud)
编辑:
需要澄清的是,我每秒更新的是锻炼计时器,因此它需要每秒更新一次。
我正在尝试为具有 Swift Package Manager 依赖项的项目获取 Github Actions。
我不断收到此错误:xcodebuild: error: Could not resolve package dependencies:15 The server SSH fingerprint failed to verify.
...当 Actions 运行并解析 Package Graph 时,会在使用 Swift Package Manager 的项目中获取依赖项。
我的步骤失败了:
- name: Build and Test
run: |
xcodebuild clean test -project xyz.xcodeproj -scheme xyz -destination "platform=iOS Simulator,OS=13.3,name=iPhone 8" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ONLY_ACTIVE_ARCH=NO
Run Code Online (Sandbox Code Playgroud)
我尝试添加for ip in $(dig @8.8.8.8 github.com +short); do ssh-keyscan github.com,$ip; ssh-keyscan $ip; done 2>/dev/null >> ~/.ssh/known_hosts每个Xcode 11 解析包,但 SSH 指纹失败,但仍然无法使其工作,我可能将其放在错误的位置或做错了。
有没有人能帮助我完成这项工作?
我有一个UITableView标题占据屏幕的整个帧.
每次应用程序进入后台,然后返回前台/活动状态时,我希望将屏幕设置回标题顶部.
我只看到了与滚动到表格顶部的答案,这些答案使用类似的东西self.tableView.scrollToRow(at: top, at: .top, animated: true),但是这不起作用,因为它只会滚动到第0部分的第0行而UITableView不是顶部的头的UITableView.
有任何想法吗?
谢谢!
编辑:试过这个
override func viewWillAppear(_ animated: Bool) {
self.tableView.setContentOffset( CGPoint(x: 0, y: 0) , animated: true)
}
Run Code Online (Sandbox Code Playgroud)
这里有一些值得注意的表设置代码:
// Set up Frames
let headerFrame: CGRect = UIScreen.main.bounds
// Background Table
self.tableView.isPagingEnabled = true
// Set up Table Header
let header = UIView(frame: headerFrame)
self.tableView.tableHeaderView = header
Run Code Online (Sandbox Code Playgroud) 我正在使用Carthage进行依赖管理,并在我的项目中有一堆警告:
" Multiple build commands for output file /Users/me/Library/Developer/Xcode/DerivedData/project-ymeymeyme/Build/Products/Debug-iphonesimulator/project.app/Frameworks/Alamofire.framework"
我不确定解决这个问题的最佳方法是从导出的数据文件夹中删除,还是从Link Binary With Libraries或Embed Frameworks中删除Build Phases?
任何的想法?谢谢!
我想知道如果我不支持它,如何不显示复杂功能系列。
示例:超大表盘
在ComplicationController.swift'sgetLocalizableSampleTemplate和getCurrentTimelineEntry方法中,我只在handler(nil)打开complication.familyExtra Large时传入 a :
case .extraLarge:
handler(nil)
Run Code Online (Sandbox Code Playgroud)
但这一定不是正确的或所有要做的,因为我的 Extra Large 并发症仍然可以选择:
但它显然不起作用或有任何数据可显示:
有谁知道我错过了什么?谢谢!
更新:
我ComplicationController.swift的getComplicationDescriptors:
func getComplicationDescriptors(handler: @escaping ([CLKComplicationDescriptor]) -> Void) {
let oneSupported = [
CLKComplicationFamily.circularSmall,
.modularSmall,
.utilitarianSmall,
.modularLarge,
.utilitarianLarge,
.graphicExtraLarge,
.graphicCircular
]
let twoSupported = [
CLKComplicationFamily.circularSmall,
.modularSmall,
.utilitarianSmall,
.utilitarianSmallFlat,
.extraLarge,
.graphicBezel,
.graphicCircular,
.graphicCorner,
.graphicRectangular,
.modularLarge,
.utilitarianLarge
]
let descriptors = [
CLKComplicationDescriptor(identifier: ComplicationIdentifier.height.rawValue, displayName: "Complication 1", supportedFamilies: oneSupported)
// Multiple …Run Code Online (Sandbox Code Playgroud) apple-watch watchkit watchos clockkit apple-watch-complication
我已经在模拟器和设备上进行了测试,不知何故手表连接停止工作在使用一次后。
我正在从Watch -> iPhone传递数据,它只能工作一次,然后停止。
有任何想法吗?
苹果手机ViewController:
var session: WCSession?
override func viewDidLoad() {
super.viewDidLoad()
if WCSession.isSupported() {
session = WCSession.default()
session?.delegate = self
session?.activate()
}
}
func session(_ session: WCSession, didReceiveApplicationContext applicationContext: [String : Any]) {
// Received Application Context from Watch
let type = applicationContext["watchType"]
print("Type iPhone: \(type)")
DispatchQueue.main.async {
self.type.text = "Type: \(type)"
}
}
Run Code Online (Sandbox Code Playgroud)
观看InterfaceController:
let session = WCSession.default()
override func awake(withContext context: Any?) {
super.awake(withContext: context) …Run Code Online (Sandbox Code Playgroud) 我在应用中使用AdMob来制作横幅广告.横幅广告显示在模拟器上,但不是在我通过连接线或TestFlight在iPhone设备上运行时.
这是我在真实设备上运行它的代码:
let request = GADRequest()
bannerView.adUnitID = realAdUnitID
bannerView.rootViewController = self
bannerView.delegate = self
bannerView.load(request)
Run Code Online (Sandbox Code Playgroud)
我错过了什么吗?
我试图看看其他问题,但没有任何对我有用,但有人建议.
谢谢!
swift ×8
ios ×6
watchkit ×5
uitableview ×2
watchos-2 ×2
xcode ×2
admob ×1
apple-watch ×1
carthage ×1
clockkit ×1
iphone ×1
sdwebimage ×1
storyboard ×1
testflight ×1
timer ×1
uiimageview ×1
watchos ×1