willhains / Kotoba

Quickly search the built-in iOS dictionary to see definitions of words. Collect words you want to remember.
MIT License
551 stars 60 forks source link

[dev question][help needed] Unable to Resize UIReferenceLibraryView #72

Closed jktzes closed 4 years ago

jktzes commented 4 years ago

Hi Will, I am using the Kotoba app and it's very helpful! I am a newbie to iOS dev so my apologies in advance if I'm asking some stupid questions. I am trying to make the UIReferenceLibraryView smaller so that I can add a search bar on the top. No offense to your design, that's just how I see fit in my read-lookup workflow. I read some documentation on UIReferenceLibraryView and can't find methods to resize the view. Later I noticed that UIReferenceLibraryView inherits from UIViewController, which has a preferredContentSize instance property. Therefore I did something like this:

let dictionaryViewController = UIReferenceLibraryViewController(term: word.text)
dictionaryViewController.preferredContentSize = CGSize(width: 200, height: 300)

However, it won't work. Is this feature possible? If so, could you tell me the right way to do it? If not, could you elaborate on why not? Thanks a lot!

Yuan

willhains commented 4 years ago

Hi Yuan, I’m glad you’re enjoying Kotoba.

In the very first version of Kotoba, that’s how it worked. I can’t remember exactly, but I think we changed it precisely because that design no longer worked in iOS. The UIReferenceLibraryViewController doesn’t give many options on how the view is presented, and I think there’s no way to embed it into a view hierarchy.

If you figure out a way to do it, let me know!

jktzes commented 4 years ago

Hi Yuan, I’m glad you’re enjoying Kotoba.

In the very first version of Kotoba, that’s how it worked. I can’t remember exactly, but I think we changed it precisely because that design no longer worked in iOS. The UIReferenceLibraryViewController doesn’t give many options on how the view is presented, and I think there’s no way to embed it into a view hierarchy.

If you figure out a way to do it, let me know!

Thanks for the answer! If possible, could you provide more details on how it "precisely no longer worked"? I'm still very new to iOS development so I am currently at the stage where I don't even know how to start to investigate where the limitation you mentioned is.

But also please feel free to ignore this message if you are busy or can't spare time on this matter.

Thanks again for reading this!

willhains commented 4 years ago

Hi Yuan, sorry, I can’t remember the details. Perhaps you should ask on StackOverflow?