質問

How can I access an attribute that's been hidden via:

__attribute__((visibility("hidden")))

I'm trying to access UINavigationItemButtonView, but it seems sometime recent (iOS 7.1?) they've added the above into the header file. Recursively printing the window no longer reveals UINavigationItemButtonView in the view stack either.

So, given a UINavigationBar, how can I access a UINavigationItemButtonView that has been hidden via the above flag?

Printing all the subviews in UINavigationBar doesn't reveal it.

役に立ちましたか?

解決

The attribute keyword is simply a message to the compiler, and has nothing to do with the runtime. Using ((visibility("xxx")) only serves to tell the compiler if the given declaration should be "visible" or usable by clients in some other package. visibility("hidden") just means that, despite the public declaration, make this thing invisible to external packages, so that they will not be able to use it. Compiling will fail if you attempt to use this class or method.

If you don't see this class being used in a recursive description, it is likely that this class is no longer used; it certainly isn't because of the attribute statement.

他のヒント

Since it's a private class, you shouldn't. Anything you do to bypass that restriction may result in your application failing the review process. Not to mention that, in general, accessing private and/or hidden API's, classes, instance variables, properties or whatever else it is, is a really good way to make sure your application breaks in the (not too distant) future.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top