|
|
#1 |
|
Expression is not Assignable
Hello,
I am working on a window that is a subclass of the INAppStoreWindow. I am attempting to add an NSTextField to the window, which I have done, but there are some "fine tuning" issues. The INAppStoreWindow is a window that lets you get its "titlebarview" and add stuff to it. I have added a textfield to it like this: Code:
[_window setTitleBarHeight:60.0]; //1
NSView *titleBarView = self.window.titleBarView; //2
newTitleView.bounds.size.width = titleBarView.bounds.size.width; //3
[titleBarView addSubview:newTitleView]; //4
Thanks! |
|
|
|
0
|
|
|
#2 |
|
This was answered on StackOverflow over here... I provided what, in my opinion, was a pretty good solution for how you can do what you want:
http://stackoverflow.com/questions/9...16702#14116702 The answer why this isn't possible is because when you type out newTitleView.bounds on the left side of an assignment, it compiles to this: Code:
[newTitleView setBounds:[titleBarView getBounds].size.width]; Something you may or may not realize is this: bounds is a property of views, but size is a member of struct CGRect and width is a member of struct CGSize... size and width are not properties. If you don't understand that, you might be in need of refreshing yourself on C structs.
__________________
Battery Status - On the Mac App Store
The only app that'll estimate when your wireless devices will need their batteries changed. Like it on Facebook! Last edited by ArtOfWarfare; Jan 26, 2013 at 09:45 PM. |
|
|
|
0
|
|
|
#3 |
|
I'm going to offer you my totally half-assed, uninformed, all-but-worthless answer here, and say that in Cocoa the only appropriate way to set the size of the bounds of an NSView is with the view's setBounds: or setBoundsSize: methods. I don't think there's any way to set only the width directly, but since an NSSize is just a struct containing two floats, you should be able to build the struct on the fly by combining titleBarView.bounds.size.width and newTitleView.bounds.size.height, and then pass the resultant struct to [newTitleView setBoundsSize:]. I'm drawing a blank on the exact syntax for doing this in Objective-C at the moment, but I'm pretty sure it's possible.
Of course, I could be completely wrong, and you should probably disregard everything I've written here.
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 05:37 PM.






Linear Mode
