答案 0 :(得分:1)
我也遇到了这个问题。这是几乎类似的post
但是大多数答案都有副作用。对我来说,最好的解决方案是
UINavigationBar.appearance().barTintColor = .clear
UINavigationBar.appearance().backgroundColor = .clear UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
UINavigationBar.appearance().shadowImage = UIImage()
,并且还希望将UIImage()设置为shadowImage和bacgroundImage而不是“ nil”很重要。我将导航displayMode设置为内联
.navigationBarTitle(Text(""), displayMode: .inline)
答案 1 :(得分:0)
在View的初始化程序中,您可以设置导航栏的外观。在那里,您必须将SELECT stop.stop_id,
CASE WHEN COUNT(DISTINCT route.route_type) > 1 THEN 'multiple'
WHEN MAX(route.route_type) = 0 THEN 'tram'
ELSE 'bus'
END AS stop_type
FROM stop
INNER JOIN stop_time on stop_time.stop_id = stop.stop_id
INNER JOIN trip on trip.trip_id = stop_time.trip_id
INNER JOIN route on route.route_id = trip.route_id
GROUP BY stop.stop_id
ORDER BY stop.stop_id
属性设置为let options = {
startDate: (new Date(2019,10,25)).toISOString(),
endDate: (new Date(2019,11,10)).toISOString(),
limit: 10,
permissions: {
read: ["Height", "Weight", "StepCount", "DateOfBirth", "BodyMassIndex", "ActiveEnergyBurned", "SleepAnalysis"],
write: ["Height", "Weight", "StepCount", "BodyMassIndex", "Biotin", "Caffeine", "Calcium", "Carbohydrates", "Chloride", "Cholesterol", "Copper", "EnergyConsumed", "FatMonounsaturated", "FatPolyunsaturated", "FatSaturated", "FatTotal", "Fiber", "Folate", "Iodine", "Iron", "Magnesium", "Manganese", "Molybdenum", "Niacin", "PantothenicAcid", "Phosphorus", "Potassium", "Protein", "Riboflavin", "Selenium", "Sodium", "Sugar", "Thiamin", "VitaminA", "VitaminB12", "VitaminB6", "VitaminC", "VitaminD", "VitaminE", "VitaminK", "Zinc", "Water"]
}};
componentDidMount(){
AppleHealthKit.initHealthKit(options: Object, (err: string, results: Object) => {
if (err) {
console.log("error initializing Healthkit: ", err);
return;
}
AppleHealthKit.getSleepSamples(options, (err: Object, results: Array<Object>) => {
if (err) {
console.log(err);
return;
}
console.log(results.length)
this.setState({sleep:results.length})
});
});
}
。
.shadowColor
答案 2 :(得分:0)
在 Xcode 12.4 中,这是对我有用的组合:
init() {
UINavigationBar.appearance().shadowImage = UIImage()
UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default)
UINavigationBar.appearance().isTranslucent = false
UINavigationBar.appearance().barTintColor = UIColor.red
}
答案 3 :(得分:-1)
SwiftUI,1行。
UINavigationBar.appearance().standardAppearance.shadowColor = .clear
我在.onAppear {}
内部实现了该功能答案 4 :(得分:-1)
这对我有用
UINavigationBar.appearance().shadowImage = UIImage()