in order to achieve clock animation on home screen widget. i use
_clockHandRotationEffect(.custom(cycleTime), in:.current, anchor: .center)
but on Xcode14, it doesn't exist anymore.
any replacement? đŸ˜
use Xcode13 and Swift to build a static library. Then call the methods exposed by the static library from Xcode14.
Related
I know that on the view you can add the following modifiers to modify the navigation bar to create a custom back button.
SomeView{ ... }
.navigationBarBackButtonHidden(true)
.toolbar {
ToolbarItem(placement: .navigationBarLeading) {
Button {
mode.wrappedValue.dismiss()
} label: {
Image(systemName: "chevron.backward")
}
}
However, I do not want to go through my entire app to every secondary view and add these modifiers. I've considered creating a reusable header component, but at the moment, I'm just wondering if there was a way to override the system default for the back button to impact the entire app.
Unfortunately In SwiftUI there is not. You could however, override UINavigationController but it is not recommended as APIs can change.
Look at List for example, we used to set the UITableView appearance background color to .clear to customize List's background, but in iOS 16 this solution works no more.
Extended View and create a func where you put your code in it, then use that function wherever you need!
I have a list in iOS 14 / Xcode 12
Im using the following/tried the following to hide the little arrows in the corner:
.listRowInsets(EdgeInsets())
.background(Color.white)
.listStyle(PlainListStyle())][1]][1]
the easiest way to remove the arrow i think is to get the NavigationLink out of the List and use the tag or isActive initialiser of NavigationLink to define whether or not the link should be activated
Hey! You need to hide the navigation link. Try This Code Below...
NavigationLink(destination: DetailView(item: yourItem)) { //Your Nav Link
EmptyView()
}.frame(width:0).opacity(0) //Hide Your Link Programmatically
I have an app that loads a tabbar with a view as initial screen, RecipeList(). Inside of RecipeList I call another view to show a recipe full screen. In RecipeList file I have code to show or hide the status bar checking if the recipe detail fullscreen view is loaded or not. It works perfectly if I preview it in xcode, BUT when I preview the code below, which is my Home() view file, and what I want to load as initial screen due to tabbar need, THEN the code inside of RecipeList to show or hide statusbar doesnt work anymore, and status bar is always on.
If i try to hide the statusbar in the code below, it works, but then is always off, something i dont want. Only wanna hide it for the fullscreen view.
I actually used this Introspect package from Github to hide the tabbar when the child view is loaded full screen, and i made it work!
SwiftUI hide TabBar in subview
https://github.com/siteline/SwiftUI-Introspect
Actually, I wonder if anyone has used Introspect to hide the statusbar like the tabbar. I tried to use it, but I am a rockie, I only know a bit of SwiftUI, no Swift, no view controller experience, nothing.
But I have a totally functional app with only this issue, and I am super frustrated not to have the skills to know why the tabbar view is forcing a persistent status bar.
Any help, please?
var body: some View {
ZStack {
Color("background2")
.edgesIgnoringSafeArea(.all)
TabView {
RecipeList().tabItem {
Image(systemName: "book.fill")
.font(.system(size: 24, weight: .bold))
Text("GalerĂa")
}
PostList(section: sectionData[0]).tabItem {
Image(systemName: "list.bullet")
.font(.system(size: 22, weight: .bold))
Text("Listado")
}
}
.accentColor(Color("accent"))
.introspectTabBarController { tabBarController in
// customize here the UITabBarViewController if you like
self.viewModel.tabBarController = tabBarController
}
}
}
I can suggest you using the #EnvironmentObject wrapper which basically allows you to use an object as global state. You can find fair amount of tutorials explaining how to do that and inject it in your initial view so that this object is accessible in the whole view hierarchy.
Once you have that global state set up, you can hide your status bar conditionally like this:
MyOutterWrapper {
Text("Some text")
}
.statusBar(hidden: myGlobalState.statusBarHidden)
If you are using NavigationView note that hiding the status bar works best if you set it up there (also assuming navigation view is your first view that appears).
Now all you got to do is inside your view set the variable to true when entering full screen and set it back to false when exiting. Hope that helps!
EDIT: Forgot to mention that hiding status bar as of June 26, 2020 only works if it's set on the initial view. You cannot change it later and that's the reason we set up this variable in order to go back and change the value dynamically.
I have pageView where in the bottom of each page there is a scrollView.
I want that the pageView doesn't turn when the scrollView is scrolling.
My problem is:
when I scroll (in the scrollView) the pages turn with him!
This may not a good practice but it can solve your problem: in Xcode go to your project/ cocos2d_libs.xcodeproject/ extensions/ GUI/ CCScrollView
In CCScrollView.h add:
void mySetSwallowTouch(bool enabled);
In CCScrollView.cpp add:
void ScrollView::mySetSwallowTouch(bool enabled) {
_touchListener->setSwallowTouches(enabled);}
Now call mySetSwallowTouch(true) at your scrollview
scrollview->mySetSwallowTouch(true);
You can also use this with your table view inside a pageView
Since cocos2d-x v3.3 there is already a method void mySetSwallowTouch(bool enabled) available for ListView.
You can simply use it:
ListView* listView = ListView::create();
listView->setSwallowTouches(true);
BTW, I believe swallow touches is currently set to true for ListView by default.
Using Rubymotion, how can I remove glossy effect on my tabbar item ?
I found this ObjC solution :
[yourTabbar setSelectionIndicatorImage:[[UIImage alloc] init]];
But the glossy effect is still there when I translate it in Ruby this way (in app_delegate.rb) :
#tab_controller.tabBar.setSelectionIndicatorImage UIImage.alloc.init
What's wrong with this ruby translation ?
I'm also using Pixate, so maybe there is an other way with simple css...
Using Pixate and CSS, you could do something like this to hide the selected state, or perhaps place an alternate image in there:
tab-bar tab-bar-item:selected {
background-color: linear-gradient(transparent, transparent);
background-size: 1;
}