Re: NSBezierPath on iOS?
Re: NSBezierPath on iOS?
- Subject: Re: NSBezierPath on iOS?
- From: Dave <email@hidden>
- Date: Mon, 22 May 2017 13:23:32 +0200
Hi,
I changed it to use UIBezierPath but now I get errors on the 3 + methods it uses - fillRect, setDefaultLineWidth and strokeRect.
From looking at the documentation, I’m guessing that I need to create a path, I’ve added this code:
-(void) drawRect:(CGRect) theRect
{
CGRect myRect;
UIBezierPath* myPath;
myRect = CGRectInset(self.bounds,self.pFrameInsetSize.width,self.pFrameInsetSize.height);
if (self.pDrawPaneFlag == YES)
{
myPath = [UIBezierPath bezierPathWithRect:myRect];
[self.pPaneColor set];
[myPath fill];
}
if (self.pDrawFrameFlag == YES)
{
myPath = [UIBezierPath bezierPathWithRect:myRect];
[self.pFrameColor set];
[myPath setLineWidth:self.pFrameLineWidth];
[myPath stroke];
}
}
Does this look right?
Also, I’m guessing it should be setNeedsDisplayInRect instead of setNeedsDisplay,
I changed this to:
[self setNeedsDisplayInRect:self.frame];
Is this correct or should it be self.bounds?
Thanks again.
All the Best
Dave
> On 22 May 2017, at 13:02, Dave <email@hidden> wrote:
>
> Thanks a lot!
>
> All the Best
> Dave
>> On 22 May 2017, at 12:43, email@hidden wrote:
>>
>> You want UI not NS BezierPath
>>
>> Sent from my iPhone
>>
>>> On May 22, 2017, at 19:23, Dave <email@hidden <mailto:email@hidden>> wrote:
>>>
>>> Sorry I should have said, this class is a Subview of UIView.
>>>
>>> I’m also getting an error on:
>>>
>>> [self setNeedsDisplay:YES];
>>>
>>> I’m so rusty on iOS and I’m finding hard to remember the differences.
>>>
>>> All the Best
>>> Dave
>>>
>>>> On 22 May 2017, at 12:09, Dave <email@hidden> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I’m converting a Class from Mac to iOS and I’ve got errors on the following code:
>>>>
>>>> if (self.pDrawPaneFlag == YES)
>>>> {
>>>> [self.pPaneColor set];
>>>> [NSBezierPath fillRect:myRect];
>>>> }
>>>>
>>>> if (self.pDrawFrameFlag == YES)
>>>> {
>>>> [self.pFrameColor set];
>>>> [NSBezierPath setDefaultLineWidth:self.pFrameLineWidth];
>>>> [NSBezierPath strokeRect:myRect];
>>>> }
>>>> }
>>>>
>>>> It seems that NSBezierPath is not available on iOS, is there something I can use that is equivalent to the above on iOS?
>>>>
>>>> All the Best
>>>> Dave
>>>>
>>>> _______________________________________________
>>>>
>>>> Cocoa-dev mailing list (email@hidden)
>>>>
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>
>>>> Help/Unsubscribe/Update your Subscription:
>>>>
>>>> This email sent to email@hidden
>>>
>>> _______________________________________________
>>>
>>> Cocoa-dev mailing list (email@hidden)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>>
>>> This email sent to email@hidden <mailto:email@hidden>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden