quartz-graphics

Setting multiple borders on UIView

岁酱吖の 提交于 2019-12-01 22:17:00
As I cannot find any questions/answers for this, I imagine it is not possible. Is there anyway to set multiple borders on a UIView . I am currently setting a standard border with .layer.borderWidth and layer.borderColor . I am wondering if I can add a multiple strokes/borders effect to the view. I need a border of 4.0f in white then another 1.0f in another color. Three solutions I can think of: nest a UIView in another one, define one border for each; draw the border yourself in -(void)drawRect ; use an UIImageView with a resizable; stretchable image of your borders as background (the best

Programmatically grab screenshots in OSX

纵然是瞬间 提交于 2019-12-01 18:58:50
I am going to port some screenshot grabbing code (C++) for linux to osx. The current solution run graphical applications in xvfb and then use xlib to grab screenshots from the display. (That will also support if we are running without xvfb). So as I understood osx is moving away from X11 so my question is what to use besides xlib to implement it now ? I have found Quartz Display Services . Is that what makes sense to use now ? Will that work with xvfb ? Yes, you will be able to call functions like CGDisplayCreateImage (documentation linked for you) by linking the Application Services framework

put subviews of a UIView in front of its CALayer?

牧云@^-^@ 提交于 2019-12-01 17:28:16
Is this possible? Basically, I want to give my UIView a subview, and have that subview be in front of the view's layer (more specifically, in front of said layer's border). Of course I could achieve the effect I want by making two subviews of the view's superview, one on top of the other. But I'd rather avoid that if possible. I looked for this for a while myself; i don't believe it is possible. I solved the issue by, as you hint at, adding the subview and the parent to the same 'container' superview. Then its just a matter of ordering the two subviews, so that your subview is above the other

Programmatically grab screenshots in OSX

早过忘川 提交于 2019-12-01 17:19:26
问题 I am going to port some screenshot grabbing code (C++) for linux to osx. The current solution run graphical applications in xvfb and then use xlib to grab screenshots from the display. (That will also support if we are running without xvfb). So as I understood osx is moving away from X11 so my question is what to use besides xlib to implement it now ? I have found Quartz Display Services. Is that what makes sense to use now ? Will that work with xvfb ? 回答1: Yes, you will be able to call

CGPDFDictionary keys

僤鯓⒐⒋嵵緔 提交于 2019-12-01 09:37:29
问题 I'm getting crazy, cause I cannot find what are the "default" keys you would have in a PDF Document. For example, if I want to retrieve an hyperlink from a CGPDFDocument, I do this: CGPDFStringRef uriStringRef; if(!CGPDFDictionaryGetString(aDict, "URI", &uriStringRef)) { break; } In this case, the key is "URI". Is there a document explaining what are the keys of a CGPDFDictionary? 回答1: It's absurd that you would have to go read 1300 page long specs just to find what keys a dictionary contains

How do I adjust a Quartz 2D context to account for a Retina display?

纵饮孤独 提交于 2019-12-01 08:09:30
I have a Quartz 2D game which draws directly onto a context. For this reason I am having to adapt the code so that it scales if appropriate for a Retina display. I am doing this using the following code: - (CGFloat) displayScale { if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { return [[UIScreen mainScreen]scale]; } else { return 1.0; } } What I am now struggling with is how to manipulate my Quartz context in my -drawRect: method to mulitply by the returned scale value. Can anyone help me with this code ? Brad Larson You don't need to change anything in your Quartz code to

iPhone - Is it ok to override UITableViewCell setSelected:animated

≯℡__Kan透↙ 提交于 2019-12-01 06:35:35
I am drawing custom UITableViewCells. My cells are opaque and are completely drawn in the drawRect of the cell to help with performance. I want to handle the look of a selected cell myself. If I don't, then the contents of my cell is covered up by the selectedBackgroundView that is added. Is it common or acceptable to override the setSelected:animated method of my cell so this is done properly. I guess if I did that, then I would not call the super's setSelected method since I would be handling how the cell will show that its selected. I would also have to set the selected property of the cell

iPhone - Is it ok to override UITableViewCell setSelected:animated

天大地大妈咪最大 提交于 2019-12-01 05:12:17
问题 I am drawing custom UITableViewCells. My cells are opaque and are completely drawn in the drawRect of the cell to help with performance. I want to handle the look of a selected cell myself. If I don't, then the contents of my cell is covered up by the selectedBackgroundView that is added. Is it common or acceptable to override the setSelected:animated method of my cell so this is done properly. I guess if I did that, then I would not call the super's setSelected method since I would be

How do I adjust a Quartz 2D context to account for a Retina display?

♀尐吖头ヾ 提交于 2019-12-01 04:58:56
问题 I have a Quartz 2D game which draws directly onto a context. For this reason I am having to adapt the code so that it scales if appropriate for a Retina display. I am doing this using the following code: - (CGFloat) displayScale { if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)]) { return [[UIScreen mainScreen]scale]; } else { return 1.0; } } What I am now struggling with is how to manipulate my Quartz context in my -drawRect: method to mulitply by the returned scale value. Can

How to draw a circle starting at the top

房东的猫 提交于 2019-12-01 04:18:21
I'm working with some example code that draws an arc using CGPaths. I've had a look around and have found documentation but I just can't seem to visualize in my head whats going on in terms of using MoveToPoint, AddLineToPoint etc. I can't 'see' what the code is doing I can just see the result. For example the code below draws an arc a full 360 degrees beginning from the 3 o clock position. For the life of me I can't figure out how to make it begin from the 12 o clock position with actually rotating the view - 90 degrees. Could somebody help me figure out this code and how I would change it to