# Enable and disable the whiteboard (/en/realtime-media/flexible-classroom/build/customize-the-ui-and-plugins/disable-whiteboard-module/ios)

> For AI agents: see the complete documentation index at [llms.txt](/llms.txt).

The whiteboard module in Flexible Classroom is implemented based on `AgoraWidget`. You can turn the whiteboard module on or off in the classroom by setting the widget state as active or inactive.

After disabling the whiteboard module, drawing tools including pencil, text box, shape, and eraser will no longer be available and users cannot upload, delete, or display class files on the whiteboard. Other features that do not rely on the whiteboard, such as uploading or deleting class files, pop-up quiz, countdown timer, and screen sharing will not be affected.

      
  
      
    ## iOS [#ios]

    In Flexible Classroom, the implementation logic of opening and closing the Whiteboard is located in the `CloudClass-iOS/SDKs/AgoraEduUI/Classes/Components/Flat/FcrBoardUIComponent.swift` file. Take the following steps to manage the Whiteboard:

    1. Add an observer to monitor widget activity

       ```swift
       // add WidgetActivityObserver
       widgetController.add(self)
       ```

    2. When the state of the Whiteboard widget activity changes, `onWidgetActive` or `onWidgetInactive` is called. When the status is `active`, open the Whiteboard by creating a Whiteboard Widget object; when the status is `inactive`, close the Whiteboard by destroying the Whiteboard Widget object as follows:

       ```swift
       extension FcrBoardUIComponent: AgoraWidgetActivityObserver {
           func onWidgetActive(_ widgetId: String) {
               guard widgetId == BoardWidgetId else {
                   return
               }

               initWidget()
           }

           func onWidgetInactive(_ widgetId: String) {
               guard widgetId == BoardWidgetId else {
                   return
               }

               deinitWidget()
           }
       }
       ```

    ## API Reference [#api-reference-1]

    ### AgoraWidgetContext [#agorawidgetcontext-1]

    #### create [#create-1]

    ```swift
    AgoraBaseWidget create(AgoraWidgetConfig config)
    ```

    Creates a widget object.

    Parameter:

    * config: The initialization configurations of the widget object.

    Return: An AgoraBaseWidget object.

    #### setWidgetActive [#setwidgetactive-1]

    ```swift
    void setWidgetActive(String widgetId,
                         String ownerUuid,
                         Map<String: Any> roomProperties,
                         AgoraWidgetFrame syncFrame,
                         Callback<Void> success,
                         Callback<Error> failure)
    ```

    Sets the widget state as active.

    Parameter:

    * widgetId: The widget ID.
    * ownerUuid: (Nullable) The ID of the user to whom the widget belongs. When the user goes offline, the `onWidgetInactive` callback will be triggered for the widgets owned by this user.
    * roomProperties: (Nullable) The room properties related to the widget.
    * syncFrame: (Nullable) The size and position of the widget.
    * success: The method call succeeds.
    * failure: The method call fails, the SDK returns an error.

    #### setWidgetInactive [#setwidgetinactive-1]

    ```swift
    void setWidgetInactive(String widgetId,
                           Callback<Void> success,
                           Callback<Error> failure)
    ```

    Sets the widget state as inactive.

    Parameter:

    * widgetId: The widget ID.
    * roomProperties: (Nullable) The room properties related to the widget.
    * success: The method call succeeds.
    * failure: The method call fails, the SDK returns an error.

    #### getWidgetActivity [#getwidgetactivity]

    ```swift
    Bool getWidgetActivity(String widgetId)
    ```

    Gets the state of a specified widget.

    Parameter:

    * widgetId: The widget ID.

    Return: Whether the widget is active or not.

    #### getWidgetConfigs [#getwidgetconfigs]

    ```swift
    Array<AgoraWidgetConfig> getWidgetConfigs()
    ```

    Gets the configurations of all widgets.

    Return: An array of the AgoraWidgetConfig objects.

    #### getWidgetConfig [#getwidgetconfig-1]

    ```swift
    AgoraWidgetConfig getWidgetConfig(String widgetId)
    ```

    Gets the configurations of a specified widget.

    Parameter:

    * widgetId: The widget ID.

    Return: An AgoraWidgetConfig object.

    #### addWidgetActiveObserver [#addwidgetactiveobserver-1]

    ```swift
    AgoraWidgetError addWidgetActiveObserver(AgoraWidgetActiveObserver observer,
                                             String widgetId)
    ```

    Registers an observer to observe the state of a specified widget. When the state of the widget changes, the SDK triggers a callback.

    Parameter:

    * observer: See AgoraWidgetActiveObserver.
    * widgetId: The widget ID.

    Return: When the widget ID is not valid, the SDK returns an error.

    #### removeWidgetActiveObserver [#removewidgetactiveobserver-1]

    ```swift
    AgoraWidgetError removeWidgetActiveObserver(AgoraWidgetActiveObserver observer,
                                                String widgetId)
    ```

    Registers the observer of a specified widget.

    Parameter:

    * observer: See AgoraWidgetActiveObserver.
    * widgetId: The widget ID.

    Return: When the widget ID is not valid, the SDK returns an error.

    ### AgoraWidgetActiveObserver [#agorawidgetactiveobserver]

    #### onWidgetActive [#onwidgetactive]

    ```swift
    void onWidgetActive(String widgetId)
    ```

    Occurs when the widget state changes to active.

    Parameter:

    * widgetId: The widget ID.

    #### onWidgetInactive [#onwidgetinactive]

    ```swift
    void onWidgetInactive(String widgetId)
    ```

    Occurs when the widget state changes to inactive.

    Parameter:

    * widgetId: The widget ID.

    
  
      
  
      
  
