Picker and PickerStyles in SwiftUI | Bootcamp #38

Picker and PickerStyles in SwiftUI | Bootcamp #38

Swiftful Thinking

3 года назад

35,824 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Rahul Singh
Rahul Singh - 04.10.2023 13:10

editing on label is not working buddy in my code

Ответить
Murad Jamal
Murad Jamal - 30.08.2023 10:35

can you change the font of the Text in the picker (style = MenuPickerStyle) ?

Ответить
Jim Cheseborough
Jim Cheseborough - 28.08.2023 16:22

For the love of God, stop saying "a-TRIB-utes"

We stress the FIRST syllable with the word: attributes.

Ответить
Hussein Awada
Hussein Awada - 18.06.2023 18:49

hello nick , the Label is not showing in the picker for xcode 14 , I've surffed the web about this problem and no one have an answer , so if you know how to solve it please upload a new video about it .
thanks

Ответить
Nadia yousef
Nadia yousef - 30.05.2023 15:25

This is how I did it to costumes the picker for the new update , I embedded the picker inside a menu {} label{} :

@State var selectedNumber: Int = 0

var body: some View {

Menu {
Picker(selection: $selectedNumber , label: EmptyView()) {
ForEach(0..<18){index in
Text("\(index)")
}
}
} label: {
cosutomlabel
}

}

var cosutomlabel: some View {
HStack{
Text("Choise: ")
Text("\(selectedNumber)")
}
.foregroundColor(.white)
.font(.title)
.fontWeight(.bold)
.padding()
.background(.blue)
.cornerRadius(10)
.shadow(color: .blue.opacity(0.3), radius: 10, x: 0, y: 10)
}


}

Ответить
Marvin Meinhard
Marvin Meinhard - 14.02.2023 13:00

Thank you for these Tutorials! Is there any native functionality to have a picker that allows multiple selections? e.g. whe i want a user to be able to select up to 3 options at a time? it seems that you have to build a workaround using a list...

Ответить
Marlhex
Marlhex - 21.01.2023 21:32

Thanks for styling the picker! on the todoList set pages per segmentedControl

Ответить
Jacquelin_Jimenez
Jacquelin_Jimenez - 07.10.2022 23:22

How would you get this picker to display on a ViewController?

Ответить
박종운
박종운 - 07.10.2022 09:08

iOS 16+
Put the picker in the list
ex)
List {
Picker(selection: $selection) {
ForEach(filterOptions, id: \.self) { option in
Text(option)
.tag(option)
}
} label: {
Text("Filter")
}
.pickerStyle(.inline) // .automatic .segement whatever
}

Ответить
serhii_r
serhii_r - 26.09.2022 14:27

Picker for iOS is changed in iOS 16. Could you make update for this?

Ответить
Skyy Moore
Skyy Moore - 01.09.2022 05:03

I think Xcode Version 13.4.1 has bugs with the label parameter. It doesn't seem to affect the Picker() in the canvas or the simulator. You might be about to find a work around on Stack Overflow.

Ответить
Skyy Moore
Skyy Moore - 01.09.2022 04:16

You can pick your nose. You can pick your friends. But you can't pick your friends' nose.

Ответить
Rohit Kulkarni
Rohit Kulkarni - 30.08.2022 07:37

Love this tutorial, seems as though the ability to customize the picker itself has some issues with iOS 15 (basically no matter what code you have itll just show the raw text), and this works perfectly fine if i load it onto an iOS 14.5 sim, has anyone found a way to make it work? I've seen a workaround to use Menu instead of picker but given the amount of people facing the issue i find it odd its been like this and also so close to iOS 16 release

Ответить
C Lewis
C Lewis - 16.08.2022 16:45

Hi Nick, great video as always but I am afraid there is a big issue when placing two pickers side by side. The select overlays hit boxes clash and you have to select before the picker or after the picker to update the number. Luckily someone has provided an extension override.

extension UIPickerView { open override var intrinsicContentSize: CGSize { return CGSize(width: UIView.noIntrinsicMetric, height: super.intrinsicContentSize.height) } }

Ответить
Dean Spann
Dean Spann - 24.07.2022 04:30

Would it be possible for you to create a tutorial on creating dropdown pickers and storing that data in a firebase collection?
Essentially creating a collection for user profile information, and then create a variable for gender that is displayed as a dropdown picker in the UI interface.

Ответить
serhii_r
serhii_r - 08.07.2022 17:00

Thanks for the video lesson! You made my day!

Ответить
Marina Sh
Marina Sh - 16.06.2022 00:33

Thank you for your brilliant videos!

Ответить
Big Foot
Big Foot - 23.05.2022 21:10

Hi. Am currently teaching myself swift using ur tuts all is smooth apart from this picker is there another way to implement it am using Xcode 13.4 and apparently the picker is working but not the label part the text component and it’s modifiers.

Ответить
Bill Southwick
Bill Southwick - 26.04.2022 23:09

I’m running iOS 15 and Xcode 13. In my first picker the picker is going from 99 to 18 even though I have 18..<100. I also see in your examples they’re not “in order” when you’re working with the strings. Is it a bug in Xcode?

Ответить