Comments (17)
I want the title bar to be as tall as the one in the second image but have a custom background image like the one in the first image. How would do this?
You can set the height of the title bar with titleBarHeight
, this is demonstrated in the sample app.
setTitleDrawingBlock:
takes a block which contains the drawing code for the title bar. Here is a simple example that draws the titlebar as a solid red color.
[self.window setTitleBarDrawingBlock:^(BOOL drawsAsMainWindow, CGRect drawingRect, CGPathRef clippingPath){
CGContextRef context = [[NSGraphicsContext currentContext] graphicsPort];
CGContextAddPath(context, clippingPath);
CGContextClip(context);
[[NSColor redColor] set];
NSRectFill(drawingRect);
}];
How would I add a Navigation Bar-like control to the title bar using INAppStoreWindow like in github for mac
You can add whatever views and controls you want to to titleBarView
.
from inappstorewindow.
@kgn thanks how would i set a window title? also how would i use a repeatable image for the background of the titleBar
like in iOS with [[UIImage imageNamed:@"myimage.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0,0,10,10)]
also to get a title bar with a custom title font (like in the first image i posted) i would have to add a NSLabel
(or whatever the Mac SDK's equivalent is to UILabel
) to the titleView
then set its font using the font
property,center it in titleView
and add it as a subview of the titleView
correct?
from inappstorewindow.
@kgn thanks for your help! My next question is how do i customize the bottom toolbar?
from inappstorewindow.
how would i use a repeatable image for the background of the
titleBar
Just like on iOS you can use CGContextDrawTiledImage
or [NSColor colorWithPatternImage:]
.
...and add it as a subview of the titleView correct?
Yes
My next question is how do i customize the bottom toolbar?
The bottom bar isn't a part of INAppStoreWindow
. The bottom bar in the sample app is enabled in IB by setting the content boarder in the size tab.
from inappstorewindow.
@kgn thanks. what is the os x equivalent of uilabel
? a uneditable nstextfield
?
from inappstorewindow.
Yep
from inappstorewindow.
@kgn thanks for all your help!
from inappstorewindow.
You're welcome, can't wait to see what you build with it :)
from inappstorewindow.
One more question lol. How can make a Mac app store-like top bar? With the tabs? I know it has something to do with NSButton but I don't know what. I also need the text that describes each tab below the tabs icon.
On Aug 10, 2012, at 2:06 PM, David Keegan [email protected] wrote:
You're welcome, can't wait to see what you build with it :)
—
Reply to this email directly or view it on GitHub.
from inappstorewindow.
You could either subclass NSButtonCell and override -drawWithFrame:inControlView: to draw a custom button that shows the image and the text, or you could just write a basic NSView subclass that draws the same thing and accepts -mouseDown: events, etc.
from inappstorewindow.
Thanks.
Sent from my iPod
On Aug 10, 2012, at 2:40 PM, Indragie Karunaratne [email protected] wrote:
You could either subclass NSButtonCell and override -drawWithFrame:inControlView: to draw a custom button that shows the image and the text, or you could just write a basic NSView subclass that draws the same thing and accepts -mouseDown: events, etc.
—
Reply to this email directly or view it on GitHub.
from inappstorewindow.
Question: how does one center the controls that you add to the titleBarView? It seems to just place it at the left hand side of the window.
from inappstorewindow.
@SevenBits Are you setting the frames of the controls and using auto resizing masks or auto layout?
from inappstorewindow.
I created an NSView and added it to the titleBarWindow of the INAppStoreWindow.
On Mar 16, 2013, at 10:28 PM, David Keegan [email protected] wrote:
@SevenBits Are you setting the frames of the controls and using auto resizing masks or auto layout?
—
Reply to this email directly or view it on GitHub.
from inappstorewindow.
@SevenBits To follow up on that, what @kgn wanted to know was whether you have auto layout enabled for your titlebar view. By default, on new nibs it is enabled. Check in Interface Builder to see if you have AL enabled or not.
Also, this question might be better suited as a new issue.
from inappstorewindow.
Okay, sorry. I'll check on that and get back to you.
On Mar 16, 2013, at 11:51 PM, Jonathan Willing [email protected] wrote:
@SevenBits To follow up on that, what @kgn wanted to know was whether you have auto layout enabled for your titlebar view. By default on new nibs, it is enabled. Check in Interface Builder to see if you have AL enabled or not.
—
Reply to this email directly or view it on GitHub.
from inappstorewindow.
Okay, so the nib in question (containing the INAppStoreWindow and the title bar controls) is using auto layout. I've tried every conceivable thing to get this to work, but no avail. I'd prefer to not have to use hacks if possible.
I should note that that this does not work even in the included Sample App. The window with a colored title bar (created with the New Window Controller button) has the same problem: I resize the window, and the title bar controls stay static.
On Mar 16, 2013, at 11:51 PM, Jonathan Willing [email protected] wrote:
@SevenBits To follow up on that, what @kgn wanted to know was whether you have auto layout enabled for your titlebar view. By default on new nibs, it is enabled. Check in Interface Builder to see if you have AL enabled or not.
—
Reply to this email directly or view it on GitHub.
from inappstorewindow.
Related Issues (20)
- when click minButton to hidden the window, then reopen,move mouse to traffic button and remove mouse, the traffic button always show RollOverImage
- Exit full screen mode in Yosemite HOT 7
- dragging to another virtual desktop is not working
- window frame.height grows from start to start if autosave name is not empty, OS X 10.9.3
- README needs update
- setMovable flag doesn't work
- Box behind title Xcode 6.1 GM HOT 2
- Yosemite double click title bar to maximum window not working HOT 1
- Cocoa pod can't find INAppStoreWindow 1.5
- bad window button positioning on Yosemite HOT 4
- TitleTextColor changes only the Window Title !
- bad way to detect yosemite
- crash, creating window from code inherit INAppStoreWindow 10.10.1 HOT 3
- Window widgets are positioned incorrectly in document-based application when showing sheets HOT 2
- Graphite system appearance appears to be ignored
- Where do I start HOT 1
- AppleMiniaturizeOnDoubleClick Isn't working HOT 2
- Window flicker when drag in the original titlebar area and move to top of the screen
- Traffic light buttons HOT 2
- Every Time At the time of Launch : NSWindow warning: adding an unknown subview: HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from inappstorewindow.