Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8799603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T00:22:07+00:00 2026-06-14T00:22:07+00:00

How does the ObjectiveC code below translate into MonoTouch? @interface PSPDFBookmarkViewController : UITableViewController <PSPDFStyleable>

  • 0

How does the ObjectiveC code below translate into MonoTouch?

@interface PSPDFBookmarkViewController : UITableViewController <PSPDFStyleable>
- (instancetype)initWithDocument:(PSPDFDocument *)document;
@property (nonatomic, weak) id<PSPDFBookmarkViewControllerDelegate> delegate;
@property (nonatomic, assign) BOOL isInPopover;
@end
  • I don’t really know what to do with the instancetype thingy (what is this?)
  • What is id<PSPDFBookmarkViewControllerDelegate>.
  • What to do with the PSPDFStyleable?

This is what I think would be the result:

[BaseType(typeof(UITableViewController)]
    interface PSPDFBookmarkViewController
    {
    void InitWithDocument(PSPDFDocument document);
    [NullAllowed]
    PSPDFBookmarkViewControllerDelegate Delegate { get; set; }
    bool IsInPopover { get; set; }
    }

And what about this interface?

@interface PSPDFBookmarkViewController (SubclassingHooks)
- (void)createBarButtonItems;
@end

What is the (SubclassingHooks) about and what is its C# cousin?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T00:22:08+00:00Added an answer on June 14, 2026 at 12:22 am

    Many questions… here’s a few answers:

    ObjectiveC init* selectors are .NET constructors. So:

    - (instancetype)initWithDocument:(PSPDFDocument *)document;
    

    should be like:

    [Export ("initWithDocument:")]
    IntPtr Constructor (PSPDFDocument document);
    

    and your other C# bindings are missing their [Export] attributes. E.g.

    [Export ("isInPopover")]
    bool IsInPopover { get; set; }
    

    Other questions:

    <PSPDFStyleable> is a Objective-C protocol, which is very similar to .NET interfaces. Now if you don’t need PSPDFStyleable then you do not have to bind it.

    What is id<PSPDFBookmarkViewControllerDelegate>.

    That’s an instance that implements PSPDFBookmarkViewControllerDelegate. You would normally bind this as PSPDFBookmarkViewControllerDelegate for the Delegate property and also add a WeakDelegate so any NSObject that implement the right selectors can be used. E.g.

    [Export ("delegate", ArgumentSemantic.Assign)][NullAllowed]
    NSObject WeakDelegate { get; set; }
    
    [Wrap ("WeakDelegate")]
    PSPDFBookmarkViewControllerDelegate Delegate { get; set; }
    

    You’ll need to add Delegates=new string [] { "WeakDelegate" } to your [BaseType] attribute. Also add Events= if you want to turn the delegate members into events. E.g.

    [BaseType (typeof (UITableViewController), Delegates=new string [] { "WeakDelegate" }, Events=new Type [] {typeof (PSPDFBookmarkViewControllerDelegate)})]
    

    (SubclassingHooks) is an Objective-C category, which is very similar to .NET extensions methods. That requires a bit of manual bindings with the existing generator.

    Finally make sure to read the binding documents that are available on Xamarin documentation portal. It’s not very complicated (your sample hits a lot of cases for very few lines) but there’s a lot of data to digest (even more if you do not know Objective-C very well).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This Monotouch code below will not cause an exception, but it also won't show
Is it possible to replicate what the code in here does in MonoTouch? Here
All code below is a stand-alone working example (greatly simplified) of what I am
Since Objective-C is basically an extension of C, Does the code get converted to
Does anyone know of any open source code for doing a preview of an
I am writing some objective-C code and i can't figure out why this does
For the following code, -How does Objective-C know to add an i to complex
The below code I'm trying to produce is trying to do this: What I'm
The library is here. http://code.google.com/p/google-api-objectivec-client/ I want to use the SDK with ARC mode
On OS X, does Objective-C compile to native code or byte-code? Can Objective-C programs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.