Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is much easier than one would think. I too went on a quest to do something similar for my app.</p> <p>Real App Store app: <img src="https://i.stack.imgur.com/bB4xj.png" alt="Here is the App Store app..."></p> <p>My App Store app look-alike: <img src="https://i.stack.imgur.com/61QbT.png" alt="My App Store look-alike..."></p> <p>No disrespect to INAppStoreWindow, it is a very good implementation and solid. The only draw back I saw from it though was that there was a lot of drawing code along with hardcoded settings for the TitleBar colors which Apple can adjust at anytime.</p> <p>So here is how I did it:</p> <p>A) Create a standard window with a Title Bar, Close, Minimize, Shadow, Resize, Full Screen - Primary Window all set. Note: You do not need a textured window nor should you set a title</p> <p>B) Next add a standard toolbar with these settings:</p> <ul> <li>Icon Only</li> <li>Visible at Launch - ON</li> <li>Customizable - OFF</li> <li>Separator - ON</li> <li>Size - Regular</li> </ul> <p>Remove all the Toolbar Items and add only these in the following order</p> <p>NSSegmentControl (51 x 24) -- | Flexible Space | -- NSSearchField (150 x 25)</p> <p>C) In your content View directly under the toolbar add a regular sized NSButton set like so:</p> <ul> <li>Bordered - OFF</li> <li>Transparent - OFF</li> <li>Title - </li> <li>Image - </li> <li>Position - Text below the button</li> <li>Font - System Small 11</li> </ul> <p>Ok, pretty easy so far, right?!</p> <p>In your Window Controller or app delegate.... setup IBOutlet(s) to your NSButton(s)</p> <p>Note: Remember to hook up your IBOutlet in interface builder</p> <p>Ok don't be scared we have to write a tiny bit of code now:</p> <p>In awakeFromNib or windowDidLoad....</p> <ol> <li>Get the content views' superview (aka NSThemeView)</li> <li>Remove your button from its superView</li> <li>Set the frame of your button</li> <li>Add the button back to the theme view</li> </ol> <p>So the code would look similar to this:</p> <pre><code>NSView *themeView = [self.contentView superview]; NSUInteger adj = 6; [self.btnFeatured removeFromSuperview]; self.btnFeatured.frame = NSMakeRect( self.btnFeatured.frame.origin.x, self.window.frame.size.height - self.btnFeatured.frame.size.height - adj, self.btnFeatured.frame.size.width, self.btnFeatured.frame.size.height); [themeView addSubview:self.btnFeatured]; </code></pre> <p>That's it! You can use your outlet to enable/disable your button, setup a mask image when selected, enable/disable the toolbar or even hide everything and add a window title. All of this without worry if Apple changes their standard Window Titlebars.</p> <p>P.S. No private frameworks were used in this posting whatsoever!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload