0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

ToolbarItem(placement: .bottomBar) { がガタガタするバグ? iOS16.5.1

Last updated at Posted at 2023-07-09

iOS16.5.1の人はiPhoneで、以下をコピペするとわかります。
下のバーがなぜか起動時に本来の位置より上にあり、すぐに元の位置に戻ります。

この現象は
ToolbarItem(placement: .bottomBar) {
ToolbarItemGroup(placement: .bottomBar) {

どちらでも起こります。

早く治してクレメンス

import SwiftUI
import CoreData

struct ContentView: View {

    @State var selected:Int? = 1
    @State var selected2:Int?
    var body: some View {
        NavigationSplitView {

            List(selection: $selected){
                NavigationLink(value: 1){
                    Text("A")
                }
                NavigationLink(value: 2){
                    Text("B")
                }
                NavigationLink(value: 3){
                    Text("C")
                }
            }
        } content: {
            if let selected = selected {
               Text(String(selected))

                List(selection: $selected2){
                    
                    
                    ForEach(0..<10000){index in
                        
                        NavigationLink(value: index){
                            Text(index.description)
                        }
                    }

                }
                
                .toolbar {
                    ToolbarItemGroup(placement: .bottomBar) {
                        Text("A")
                    }
                    
                }
            } else {
                Text("No Selected")
            }
        } detail: {
            Text("Hi")
            if let selected2 = selected2 {
                Text(String(selected2))
            }else{
                Text("No Selected")
            }

        }

    }


}

なんか色々やってもダメ



import SwiftUI
import CoreData

struct ContentView: View {
    
    @State var selected:Int? = 1
    @State var selected2:Int?
    var body: some View {
        NavigationSplitView {
            
            List(selection: $selected){
                NavigationLink(value: 1){
                    Text("A")
                }
                NavigationLink(value: 2){
                    Text("B")
                }
                NavigationLink(value: 3){
                    Text("C")
                }
            }
        } content: {
            VStack{
                
                
                if let selected = selected {
                    Text(String(selected))
                    
                    VStack(alignment:.leading){
                        
                        ScrollView{
                            
                            
                            ForEach(0..<10000){index in
                                
                                Text(index.description)
                                
                            }
                        }
                        
                    }
                    
                } else {
                    Text("No Selected")
                }
                
            }
            .toolbar {
                ToolbarItem(placement: .bottomBar) {
                    Text("A")
                }
                
            }
        } detail: {
            Text("Hi")
            if let selected2 = selected2 {
                Text(String(selected2))
            }else{
                Text("No Selected")
            }
            
        }
        
    }
    
    
}



0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?