How to change NSRect to CGRect?

后端 未结 3 977
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-19 03:23
-(void)drawRect : (NSRect)rect 
{    
        imgRect.orgin = NSZeroPoint;

        imgRect.size = [appleImage size];

        drawRect = [self bounds];

        [ap         


        
3条回答
  •  没有蜡笔的小新
    2021-01-19 03:49

    If you encounter this in iOS, such as with UIKeyboardFrameEndUserInfoKey, it's important to know that NSRect is a subclass of NSValue.

    if let rectValue = notification.userInfo?[UIKeyboardFrameEndUserInfoKey] as? NSValue {
        let rect = rectValue.CGRectValue()
        // Use your CGRect
    }
    

提交回复
热议问题