[MonoTouch] EXC_BAD_ACCESS with NSString sizeWithFont:constrainedToSize:lineBreakMode:

Geoff Norton gnorton at novell.com
Fri Oct 16 08:40:24 EDT 2009


Ed,

   Try UIView.StringSize (msg, font, max_size, mode);

-g

On 16-Oct-09, at 2:55 AM, Ed Anuff wrote:

> I'm trying to use the sizeWithFont method in NSString using the
> following code.  It works fine on the simulator, but crashes on the
> device.  Any thought on how to fix this?
>
>
> public static SizeF StringSizeWithFontConstrainedToSize(string msg,
> UIFont font, SizeF max_size, UILineBreakMode mode)
> {
> 	NSString target = new NSString(msg);
> 	Selector selector = new Selector
> ("sizeWithFont:constrainedToSize:lineBreakMode:");
> 	SizeF size = cgsize_objc_msgSend_IntPtr_cgsize_int(
> 		target.Handle,
> 		selector.Handle,
> 		font == null ? IntPtr.Zero : font.Handle,
> 		max_size,
> 		mode);
> 	return size;
> }
> _______________________________________________
> MonoTouch mailing list
> MonoTouch at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monotouch



More information about the MonoTouch mailing list