[iOS开发]获取 Object-C 类的接口的函数名列表

procedure TForm1.Button7Click(Sender: TObject);
var
  ACls: Pointer;
  AList: PPointer;
  I, ACount: Integer;
  S, AName: String;
  AMethod: TIOSAppBeginBackgroundTask;
begin
  ACls := objc_getClass(MarshaledAString('UIApplication'));
  if Assigned(ACls) then
  begin
    AList := class_copyMethodList(ACls, ACount);
    if ACount > 0 then
    begin
      S := '';
      for I := 0 to ACount - 1 do
      begin
        S := S + sel_getName(method_getName(AList^)) + SLineBreak;
        Inc(AList);
      end;
      Memo1.Text := S;     
    end;
    __free(AList);
  end;

 

分享到: