def build_view
      # Only in the 'layout' method will we allow default container to be
      # created automatically (when 'add' is called)
      @assign_root = true
      prev_should_run = @should_run_deferred
      @should_run_deferred = true
      layout
      unless @view
        if @assign_root
          create_default_root_context
          @view = @context
        else
          NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')
        end
      end
      run_deferred(@view)
      @should_run_deferred = prev_should_run
      @assign_root = false
      # context can be set via the 'create_default_root_context' method, which
      # may be outside a 'context' block, so make sure to restore context to
      # it's previous value
      @context = nil

      if @preset_root
        @view = WeakRef.new(@view)
        @preset_root = nil
      end

      @view
    end
def build_view
      # Only in the 'layout' method will we allow default container to be
      # created automatically (when 'add' is called)
      @assign_root = true
      prev_should_run = @should_run_deferred
      @should_run_deferred = true
      layout
      unless @view
        if @assign_root
          create_default_root_context
          @view = @context
        else
          NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')
        end
      end
      run_deferred(@view)
      @should_run_deferred = prev_should_run
      @assign_root = false
      # context can be set via the 'create_default_root_context' method, which
      # may be outside a 'context' block, so make sure to restore context to
      # it's previous value
      @context = nil

      if @preset_root
        @view = WeakRef.new(@view)
        @preset_root = nil
      end

      @view
    end
This method builds the layout and returns the root view.