2016-07-06 6 views
0

私はProMotionのドキュメントとサンプルのどこにでも見ましたが、TableScreenレイアウト、具体的にはTableViewセルの垂直開始位置を変更する方法を見つけることができません。ProMotionテーブルスクリーンレイアウトを変更

私は画面の上部にいくつかのボタンを表示するためのUIViewを持っています、そして、TableViewセルは下から始めるべきですが、今はお互いの上にあります。

私はREPLコンソールを使用してテーブルビューを移動させることも、管理している:

4496872960は私 UITableViewWrapperViewオブジェクトのidですが、私は、レイアウトを置くためには、コードにこのオブジェクトの座標見当がつかない
rmq(4496872960).nudge d: 10 

マイスクリーンコード:

class HomeScreen < PM::TableScreen 
    title I18n.t("home_screen.title") 
    tab_bar_item title: I18n.t("home_screen.title"), item: "icon-home_32x32.png" 
    row_height :auto, estimated: 30 
    stylesheet HomeScreenStylesheet 

    def on_load 
    @matches = [{attributes: {status: "dummy1", player2: {email: "[email protected]atch.com"}}},{attributes: {status: "dummy2", player2: {email: "[email protected]"}}}] 
    append(TopHomeView, :top_home_view) 
    set_nav_bar_button :left, title: I18n.t("home_screen.sign_out_label"), image: image.resource("icon-logout-32x32.png"), action: :sign_out 
    set_nav_bar_button :right, title: (Auth.current_user ? Auth.current_user["email"] : ""), image: image.resource("icon_user_50x50.png"), action: :open_profile 

    load_async 
    end 

    def table_data 
    [{ 
     cells: @matches.map do |match| 
     { 
      title: match[:attributes][:player2][:email], 
      subtitle: match[:attributes][:status], 
      action: :play_round, 
      arguments: { match: match } 
     } 
     end 
    }] 
    end 

EDIT:

私はこの問題を解決しようと続けていると私は今、このように私のUITableViewWrapperViewオブジェクトにスタイルを追加しました:で

def viewDidLoad 
    super 
    rmq(UITableViewWrapperView).apply_style(:style_for_table_wrapper) 
end 

を私のスタイルシート私はしたがって、すべてのスタイルを行うことができます:background_color、隠されたステータスが、フレームのスタイルはちょうど無視されます。このGithubの号に示されているように

def top_home_view(st) 
    st.frame = {l:20, t: 20, w: 300, h: 60} 
    st.background_color = color.white 
end 

答えて

0

:ここ

https://github.com/infinitered/ProMotion/issues/784#issuecomment-230962988

ソリューションはTableScreenのヘッダビューを実装することにあります。これは、私たちは私たち自身の使用のための細胞の上に面積を持っていることができます:

はUIViewの(必要な)のインスタンスを返すtable_header_viewの定義:「ビッグバン方式は」(作成することを

class HomeScreen < PM::TableScreen 
    # ... 
    def table_header_view 
    create!(TopHomeView, :top_home_view) 
    end 

注意を! )はUIViewのインスタンスを返します。

クレジット

をこれをクリアするため https://github.com/andrewhavensに行きます