Posts

Post marked as solved
7 Replies
3.7k Views
I want to position the image of a UITabBarItem with the imageInsets Property, but whenever I use a SystemItem or an SFSymbol as UIImage it doesn't work. Contrary to this a normal custom image works just fine and I tried it in code and with the storyboard. So my problem is that the position of some SFSymbols is not properly centred, is there a way to fix this?
Posted Last updated
.
Post not yet marked as solved
2 Replies
6.6k Views
As the title suggests, I would like to push a ViewController onto the navigation stack, not full screen but as a popover, but despite setting the modalPresentationStyle to .popover at various positions I can't get it to work, it is still presented in full screen. If I use present(vc, ani, comp) it works, but not with pushing. For clarity, it should look like the iOS Clock or Calendar app, when you add an alarm or create a new event.
Posted Last updated
.
Post not yet marked as solved
0 Replies
285 Views
As the title suggests, I would like to push a ViewController onto the navigation stack, not full screen but as a popover, but despite setting the modalPresentationStyle to .popover at various positions I can't get it to work, it is still presented in full screen. I the end it should be like in the Clock App, when you add an alarm.
Posted Last updated
.
Post not yet marked as solved
9 Replies
576 Views
Hello everyone,I got a question and here is a little example to demonstrate it.Lets suppose I got a class Soldier which has some typical attributes.class Soldier { var healthPoints: Int var attack: Int var defense: Int var type: SoldierType...}enum SoldierType { case ARCHER case INFANTRY case CAVALARY}Now I want to use several soldier types with different default values therefore I have two ideas:1. Subclassing the Soldier class and then providing an initializer for each type of soldier I want.e.g.class Archer: Soldier { init() { super.init() healtPoints = 100 attack = 10 defense = 2 type = .ARCHER }}...2. My second approach would be to initialize the Soldier with a type and then switch the type.init(type: SoldierType) { self.type = type switch type { case .ARCHER: healtPoints = 100 attack = 10 defense = 2 ...}I hope Iam not on a completly wrong path.If not, I would prefer the first option,but since Swift has no access modifier for the class and subclasses only, I would have to make everything private and provide setter, which I really do not like.If there are other better ways, I would be glad if you let me know.Thanks in advanceChris
Posted Last updated
.
Post not yet marked as solved
0 Replies
280 Views
Is there an easy way to detect touch only on the non transparent parts of a spritenode.I know that you can use the physicsbody of the spritenode,but isn't that way to expensive when you got hundreds of nodes in your scene.
Posted Last updated
.
Post marked as solved
3 Replies
4.9k Views
Hey, I got a question, I know how "normal" deallocation works and now Iam trying it a bit with ViewControllers,but no matter what I do nothing works. I tried it with an empty inital ViewController who just presents another,but the inital one is still in the memory.import UIKitclass ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() } override func viewDidAppear(_ animated: Bool) { dismiss(animated: true) present(TestController(), animated: true) } deinit { print("deinit") }}So how do I get this ViewController deallocated when Iam presenting the new one ?
Posted Last updated
.