app :: CompositeControl :: add
item
as a child of self
redef fun add(item)
do
# Adding a view to a UITableView is a bit tricky.
#
# Items are added to the Objective-C view only by callbacks.
# We must store the sub views in local lists while waiting
# for the callbacks.
#
# As usual, we keep the Nity object in `items`.
# But we also keep their native counterparts in a list of
# the `UITableViewAndDataSource` set as `native.delegate`.
# Otherwise the native views could be freed by the Objective-C GC.
# TODO use an adapter for the app.nit ListLayout closer to what exists
# on both iOS and Android, to support large data sets.
if item isa View then
add_view_to_native_list(native, item.native)
end
super
# Force redraw and trigger callbacks
native.reload_data
end
lib/ios/ui/ui.nit:511,2--535,4
redef fun add(view)
do
super
if view isa View then
native_stack_view.add_arranged_subview view.native
end
end
lib/ios/ui/ui.nit:488,2--495,4
redef fun add(item)
do
super
if item isa View then
var native_row = new GtkListBoxRow
#native_row.activable = false # TODO with GTK 3.14
#native_row.selectable = false
native_row.add item.native
native_rows[item] = native_row
native_list_box.add native_row
native_row.show
end
end
lib/linux/ui.nit:208,2--221,4