• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view


  • Subject: Re: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
  • From: Roland King <email@hidden>
  • Date: Mon, 30 Dec 2013 14:36:06 +0800

Do you really have a space between V: and [toolbar]? I'd remove that.



On 30 Dec, 2013, at 2:28 pm, Donald Hall <email@hidden> wrote:

> Hi all,
>
> I am trying to add a layout constraint to my container view programmatically by putting the following code in the view controller (which I got and modified from Apple's UIViewController docs):
> -------------
> [toolbar setTranslatesAutoresizingMaskIntoConstraints: NO];
>     id topGuide = self.topLayoutGuide;
>     NSDictionary *viewsDictionary = NSDictionaryOfVariableBindings (toolbar, topGuide);
>     [self.view addConstraints:
>     [NSLayoutConstraint constraintsWithVisualFormat: @"V: [toolbar]-20-[topGuide]"
>     options: 0
>     metrics: nil
>     views: viewsDictionary]];
>     [self.view layoutSubviews]; // You must call this method here or the system raises an exception
> -------------
> "toolbar" is a UIToolBar at the top of the view.
>
> This doesn't work. I get the following:
>
> 'NSInvalidArgumentException', reason: 'Unable to parse constraint format:
> Expected a view
> V: [toolbar]-20-[topGuide]
>  ^'
>
> Does anyone have any ideas where I am going wrong? I tried using the view instead of topGuide, but got the same error message.
>
> I am trying to keep the tool bar from underlapping the status bar in iOS 7, while keeping iOS 6 compatibility. (Xcode 5.0.2, Base SDK iOS 7.0)
>
> Thanks, Don
>
> ------------
> Don Hall
> Apps & More Software Design, Inc.
> http://www.appsandmore.com
> 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


  • Follow-Ups:
    • Re: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
      • From: Donald Hall <email@hidden>
References: 
 >'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view (From: Donald Hall <email@hidden>)

  • Prev by Date: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
  • Next by Date: Re: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
  • Previous by thread: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
  • Next by thread: Re: 'NSInvalidArgumentException', reason: 'Unable to parse constraint format: Expected a view
  • Index(es):
    • Date
    • Thread