我想隐藏的NSScroller第NSScrollView.我知道这些方法setHasHorizontalScroller:和setHasVerticalScroller:.但是,如果我禁用滚动条,那么在该方向上滚动也会被禁用.我只想隐藏滚动条,同时保持滚动的可能性.有什么想法吗?
当应用程序在后台触发任务时更新位置.但无法使用后台模式执行任务.我的scheduleBackgroundRefreshWithPreferredDate示例代码如下所示
[WKExtension.sharedExtension scheduleBackgroundRefreshWithPreferredDate:[NSDate dateWithTimeIntervalSinceNow:60] userInfo:nil scheduledCompletion:^(NSError * _Nullable error) {
if(error == nil) {
NSLog(@"background refresh task re-scheduling successfuly ");
} else{
NSLog(@"Error occurred while re-scheduling background refresh: %@",error.localizedDescription);
}
}];
Run Code Online (Sandbox Code Playgroud)
计划任务重新安排后 handleBackgroundTasks:
- (void)handleBackgroundTasks:(NSSet<WKRefreshBackgroundTask *> *)backgroundTasks
{
for (WKRefreshBackgroundTask * task in backgroundTasks) {
if ([task isKindOfClass:[WKApplicationRefreshBackgroundTask class]]) {
WKApplicationRefreshBackgroundTask *backgroundTask = (WKApplicationRefreshBackgroundTask*)task;
// location update methods schedule as background task
[self startLocationUpdate];
[backgroundTask setTaskCompleted];
} else if ([task isKindOfClass:[WKSnapshotRefreshBackgroundTask class]]) {
WKSnapshotRefreshBackgroundTask *snapshotTask = (WKSnapshotRefreshBackgroundTask*)task;
[snapshotTask …Run Code Online (Sandbox Code Playgroud) 我已经在 List 中嵌套了一个 ScrollView 并且该 ScrollView 包含一个 NavigationLink,当用户点击链接时,链接不会导航到目的地。
var body: some View {
NavigationView {
List {
HeaderSection()
VStack(alignment: .leading) {
Text(title.explore)
.font(.custom(App.fontBold, size: 21.0))
.fontWeight(.medium)
.foregroundColor(.white)
.padding(.top, 5.0)
.padding(.bottom, 5.0)
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(self.viewModel.photos) { photo in
NavigationLink(destination: ExploreDetails(photo: photo)) {
ExploreView(photo: photo)
}
}
}
}
}
ForEach(viewModel.photos) { photo in
ImageRow(photo: photo)
.onTapGesture {
self.showModal.toggle()
self.selectedPhoto = photo
}
}.listRowInsets(EdgeInsets())
}
.navigationBarItems(trailing: profileButton)
.edgesIgnoringSafeArea(.vertical)
.sheet(isPresented: self.$showModal, onDismiss:{ print("dissmiss")} ) {
ContentDetailsView(photo: self.selectedPhoto!)
}
} …Run Code Online (Sandbox Code Playgroud) ios ×2
objective-c ×2
appkit ×1
listview ×1
nsscrollview ×1
scrollview ×1
swift ×1
swiftui ×1
watchkit ×1
watchos-3 ×1
watchos-4 ×1
xcode11 ×1