Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
05/31/13 10:36 PM (12 years ago)

NAD Advanced Quiz screen is blank

I am trying to use this plugin, but I am getting a blank screen when it loads. I get a couple errors that might not be related to this plugin, but I can't figure out what is wrong. I followed the instructions (GameKit framework, added code to navigationController, etc.). Here is the log below entries when I click the menu item that loads this plugin. I pulled the two ERROR lines out for clarity. Novice iOS coder. Any insights would be greatly appreciated. ++++++++++++++++++ 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_viewControllerManager: initViewControllerForScreen: ERROR, could not initialize view controller for screen with itemId: D0D8C247D235236D110C4BF 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_viewControllerManager: getErrorViewController ++++++++++++++++++ Full set of log entries when screen is loaded: +++++++++++++++++++++++++++ 2013-05-31 22:28:31.156 testbuzz[4579:1fd03] BT_screen_menuListSimple: didSelectRowAtIndexPath: Selected Row: 1 2013-05-31 22:28:31.156 testbuzz[4579:1fd03] BT_application: getScreenDataByItemId D0D8C247D235236D110C4BF 2013-05-31 22:28:31.157 testbuzz[4579:1fd03] BT_application: screenType is NAD_advanced_quiz for screen with nickname: "Advanced Quiz" and itemId: D0D8C247D235236D110C4BF 2013-05-31 22:28:31.157 testbuzz[4579:1fd03] BT_viewControllerManager: handleTapToLoadScreen 2013-05-31 22:28:31.157 testbuzz[4579:1fd03] BT_viewControllerManager: the parent screen nickname: "Home Screen Menu" itemId: F91C594A1D838FFEC9792EA itemType: BT_screen_menuListSimple 2013-05-31 22:28:31.157 testbuzz[4579:1fd03] BT_viewControllerManager: the menu/button tapped is itemId: 9899184858B6517AE4BF971 2013-05-31 22:28:31.157 testbuzz[4579:1fd03] BT_viewControllerManager: the screen to load is nickname: "Advanced Quiz" itemId: D0D8C247D235236D110C4BF itemType: NAD_advanced_quiz 2013-05-31 22:28:31.158 testbuzz[4579:1fd03] BT_viewControllerManager: initViewControllerForScreen nickname: "Advanced Quiz" itemId: D0D8C247D235236D110C4BF type: NAD_advanced_quiz 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_viewControllerManager: initViewControllerForScreen: ERROR, could not initialize view controller for screen with itemId: D0D8C247D235236D110C4BF 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_viewControllerManager: getErrorViewController 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_viewController: INIT 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_navigationController: pushViewController 2013-05-31 22:28:31.159 testbuzz[4579:1fd03] BT_navigationController: pushViewController for screen: D0D8C247D235236D110C4BF 2013-05-31 22:28:31.160 testbuzz[4579:1fd03] BT_screen_menuListSimple: viewWillDisappear in BT_viewController BASE CLASS 2013-05-31 22:28:31.160 testbuzz[4579:1fd03] testbuzz_appDelegate: supportedInterfaceOrientationsForWindow 2013-05-31 22:28:31.161 testbuzz[4579:1fd03] BT_viewController: canBecomeFirstResponder in BT_viewController BASE CLASS 2013-05-31 22:28:31.515 testbuzz[4579:1fd03] BT_viewController: viewDidAppear in BT_viewController BASE CLASS
 
Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
like
05/31/13 11:14 PM (12 years ago)
And I did drop the BT_xyz folders into Xcode project already. I am able to display a Custom HTML/Text plugin screen from my basic app.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/01/13 06:11 AM (12 years ago)
Just for giggles, I'd delete the 'reference' to the files, and re add them to the project. I understand what you've said; the plugins were added. But something looks off in the viewController, and if nothing else, it's a confirmation. It's a start anyway. Cheers! -- Smug
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/01/13 08:32 AM (12 years ago)
Things to check: Build settings set to ios 6? Using the latest version of the plugin, ver 1.3? As smug said the reference to the screen could be off. Maybe a typo. Screen shots of the control panel would be helpfull. And you could always send me a copy of your project files if you want me to look at it.
 
Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
like
06/01/13 12:56 PM (12 years ago)
Thanks for the tips. I did verify that the plugins was not correct and redownloaded my code and added them into the Xcode project properly. So now I see the Interactive Quiz plugin is working fine now, but NAD Advanced Quiz still is not. So I dusted off my Xcode debugger skills, novice as they are, and poked around and found out some useful details. Here's the skinny... In BT_viewControllerManager.initiViewControllerForScreen, there is a few lines of code that attempt to get the Class object for the plugin. Here's that set of code: +++++++++++++++ //screenType required if([theClassName length] > 0){ Class theClass = NSClassFromString(theClassName); NSLog(@"theClass = %@", theClassName); if(theClass != nil){ if([theClass respondsToSelector:@selector(alloc)]){ theViewController = [[theClass performSelector:@selector(alloc)] initWithScreenData:theScreen]; return theViewController; } } }//screenType length +++++++++++++++ This line: Class theClass = NSClassFromString(theClassName); fails to get the class name so it is nil. My question is what would cause this? The plugin is in there. What else should I check for?
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/01/13 01:22 PM (12 years ago)
Are you downloading you files from buzztouch.com or a self hosted CP?
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/01/13 01:27 PM (12 years ago)
Does your Nad_advanced_quiz.h look like this? #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import "BT_viewController.h" @interface Nad_advanced_quiz : BT_viewController { } @end
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/01/13 01:57 PM (12 years ago)
It looks like the BT packager is downloading the wrong code for NAD_advanced_quiz.h and NAD_advanced_quiz.m Get the 'download self hosted package' zip file for this plugin from your CP. Swap the .m and .h files in the download for the files in Xcode. Let us know if that helps.
 
Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
like
06/01/13 02:58 PM (12 years ago)
Yes, my .h file did look like that and replacing the .h/.m files with the self hosted versions worked - sort of. In the .m there was an "import BT_appDelegate.h", but the appDelegate in my project was called testbuzz_appDelegate (testbuzz = name of my project). So I replaced all references to BT_appDelegate with testbuzz_appDelegate and it works great. Not sure if that is a bug or not, but just a heads up. Also, in the docs for your plugin, it says to add some code to "line 151" but it appears that maybe that is not the correct line anymore because it is inside of a method. Maybe differences between BuzzTouch and self hoste? Not sure, I am still learning all about BuzzTouch. Thanks so much for your assistance. Able to move forward with the app now. Very nice. Feature Request: Provide option for a "next question" button after you answer the current question and allow an "explanation" to be displayed when the answer is wrong (and/or right). This would be instead of the time delay to show the next question. I might attempt to customize it in my project to do this as an excuse to learn more iOS coding. Great plugin. Thanks for your contribution. Cheers Craig
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/01/13 03:03 PM (12 years ago)
That feature has been requested a few times. I think it might be time to get started building it.
 
Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
like
06/01/13 03:26 PM (12 years ago)
That would be sweet. I have an immediate need for it. Considering yourself "followed". ;)
 
Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
like
06/03/13 09:19 PM (12 years ago)
Got another feature request (is there a proper place for this?). A way for the user to select the number of questions before the quiz instead of hard coding into the config. Another project I could try to to tackle myself with some custom code.
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/03/13 09:52 PM (12 years ago)
That can be done with a menu plugin. Use one of the codes to check out my NRC app. https://www.buzztouch.com/forum/thread.php?tid=97E00D4AC9808933A01870A&fid=06DB0BCB08E8888&sortColumn=FT.id&sortUpDown=&currentPage=1 It uses the Animated Circle menu to let the user choose a 5, 10, 20, 30, 40, or 50 question quiz. Your BT_config will end up looking something like this. ------------------------------------------------------------------------ The animated circle menu part: { "itemId": "BwrAniCircleBreakers", "itemType": "CR_animated_circlemenu", "itemNickname": "BreakersRelaysDisconnectsBWR", "navBarTitleText": "Number of Questions", "navBarStyle": "solid", "navBarRightButtonTapTransitionType": "grow", "smallCenterButtonImage": "centerButton2.png", "largeCenterButtonImage": "centerButton.png", "smallButtonSize": "80", "largeButtonSize": "100", "smallMenuSize": "275", "largeMenuSize": "400", "includeAds": "0", "backgroundColor": "#666666", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [ { "itemId": "B848052F438079F4E9B98081", "itemType": "BT_menuItem", "loadScreenWithItemId": "BwrBreakerRelay5", "titleText": "5q", "smallImageName": "5Button.png", "largeImageName": "5Button.png", "transitionType": "fade" }, { "itemId": "B5C0340D5FD0665D4AD8F42D", "itemType": "BT_menuItem", "loadScreenWithItemId": "BwrBreakerRelay10", "titleText": "10q", "smallImageName": "10Button.png", "largeImageName": "10Button.png", "transitionType": "fade" }, { "itemId": "B7CCB1C2EBF2657AD3A0EEE8", "itemType": "BT_menuItem", "loadScreenWithItemId": "BwrBreakerRelay20", "titleText": "20q", "smallImageName": "20Button.png", "largeImageName": "20Button.png", "transitionType": "fade" }, { "itemId": "BE348F8DF915B50A6270B9CE", "itemType": "BT_menuItem", "loadScreenWithItemId": "BwrBreakerRelay30", "titleText": "30q", "smallImageName": "30Button.png", "largeImageName": "30Button.png", "transitionType": "fade" }, { "itemId": "BCC225660A52BFB9E0D3787F", "itemType": "BT_menuItem", "loadScreenWithItemId": "BwrBreakerRelay40", "titleText": "40q", "smallImageName": "40Button.png", "largeImageName": "40Button.png", "transitionType": "fade" }, { "itemId": "B3711277008BB7307ABC10F1", "itemType": "BT_menuItem", "loadScreenWithItemId": "BwrBreakerRelay50", "titleText": "50q", "smallImageName": "50Button.png", "largeImageName": "50Button.png", "transitionType": "fade" } ] } ----------------------------------------------------------- And now the part of BT_config for the NAD Advanced Quiz. { "itemId": "BwrBreakerRelay5", "itemType": "NAD_advanced_quiz", "itemNickname": "Breakers_bwr_5", "navBarTitleText": "5", "navBarStyle": "solid", "number_of_questions": "5", "randomize_question_order": "1", "show_correct_answers": "1", "show_incorrect_answers": "1", "delay_between_questions": "2", "button_color_correct": "#5bac26", "button_color_incorrect": "#d81417", "show_timer": "1", "show_score_box": "1", "points_per": "1", "question_background_color": "#FFFFFF", "button_color_answers": "#FFFFFF", "enableGameCenter": "0", "share_via_email": "1", "emailScoreSubject": "NRCGenericFundamentalsPracticeExam", "emailScoreMessage": "http://nrcgfe.com", "share_via_tmFB": "1", "tmFBText": "NRCGenericFundamentalsPracticeExam", "tmFBImageName": "Icon-72.png", "tmFBURL": "http://nrcgfe.com", "share_via_tmTWT": "1", "tmTWTText": "NRCGenericFundamentalsPracticeExam", "tmTWTImageName": "Icon-72.png", "tmTWTURL": "http://nrcgfe.com", "share_via_atTWT": "0", "dataURL": "Breakers_relays_and_disconnects_bwr_img.txt", "text_just": "left", "font_size_questions_small": "20", "font_size_answers_small": "20", "font_size_questions_large": "25", "font_size_answers_large": "25", "includeAds": "0", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [] }, { "itemId": "BwrBreakerRelay10", "itemType": "NAD_advanced_quiz", "itemNickname": "Breakers_bwr_10", "navBarTitleText": "10", "navBarStyle": "solid", "number_of_questions": "10", "randomize_question_order": "1", "show_correct_answers": "1", "show_incorrect_answers": "1", "delay_between_questions": "2", "button_color_correct": "#5bac26", "button_color_incorrect": "#d81417", "show_timer": "1", "show_score_box": "1", "points_per": "1", "question_background_color": "#FFFFFF", "button_color_answers": "#FFFFFF", "enableGameCenter": "0", "share_via_email": "1", "emailScoreSubject": "NRCGenericFundamentalsPracticeExam", "emailScoreMessage": "http://nrcgfe.com", "share_via_tmFB": "1", "tmFBText": "NRCGenericFundamentalsPracticeExam", "tmFBImageName": "Icon-72.png", "tmFBURL": "http://nrcgfe.com", "share_via_tmTWT": "1", "tmTWTText": "NRCGenericFundamentalsPracticeExam", "tmTWTImageName": "Icon-72.png", "tmTWTURL": "http://nrcgfe.com", "share_via_atTWT": "0", "dataURL": "Breakers_relays_and_disconnects_bwr_img.txt", "text_just": "left", "font_size_questions_small": "20", "font_size_answers_small": "20", "font_size_questions_large": "25", "font_size_answers_large": "25", "includeAds": "0", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [] }, { "itemId": "BwrBreakerRelay20", "itemType": "NAD_advanced_quiz", "itemNickname": "Breakers_bwr_20", "navBarTitleText": "20", "navBarStyle": "solid", "number_of_questions": "20", "randomize_question_order": "1", "show_correct_answers": "1", "show_incorrect_answers": "1", "delay_between_questions": "2", "button_color_correct": "#5bac26", "button_color_incorrect": "#d81417", "show_timer": "1", "show_score_box": "1", "points_per": "1", "question_background_color": "#FFFFFF", "button_color_answers": "#FFFFFF", "enableGameCenter": "0", "share_via_email": "1", "emailScoreSubject": "NRCGenericFundamentalsPracticeExam", "emailScoreMessage": "http://nrcgfe.com", "share_via_tmFB": "1", "tmFBText": "NRCGenericFundamentalsPracticeExam", "tmFBImageName": "Icon-72.png", "tmFBURL": "http://nrcgfe.com", "share_via_tmTWT": "1", "tmTWTText": "NRCGenericFundamentalsPracticeExam", "tmTWTImageName": "Icon-72.png", "tmTWTURL": "http://nrcgfe.com", "share_via_atTWT": "0", "dataURL": "Breakers_relays_and_disconnects_bwr_img.txt", "text_just": "left", "font_size_questions_small": "20", "font_size_answers_small": "20", "font_size_questions_large": "25", "font_size_answers_large": "25", "includeAds": "0", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [] }, { "itemId": "BwrBreakerRelay30", "itemType": "NAD_advanced_quiz", "itemNickname": "Breakers_bwr_30", "navBarTitleText": "30", "navBarStyle": "solid", "number_of_questions": "30", "randomize_question_order": "1", "show_correct_answers": "1", "show_incorrect_answers": "1", "delay_between_questions": "2", "button_color_correct": "#5bac26", "button_color_incorrect": "#d81417", "show_timer": "1", "show_score_box": "1", "points_per": "1", "question_background_color": "#FFFFFF", "button_color_answers": "#FFFFFF", "enableGameCenter": "0", "share_via_email": "1", "emailScoreSubject": "NRCGenericFundamentalsPracticeExam", "emailScoreMessage": "http://nrcgfe.com", "share_via_tmFB": "1", "tmFBText": "NRCGenericFundamentalsPracticeExam", "tmFBImageName": "Icon-72.png", "tmFBURL": "http://nrcgfe.com", "share_via_tmTWT": "1", "tmTWTText": "NRCGenericFundamentalsPracticeExam", "tmTWTImageName": "Icon-72.png", "tmTWTURL": "http://nrcgfe.com", "share_via_atTWT": "0", "dataURL": "Breakers_relays_and_disconnects_bwr_img.txt", "text_just": "left", "font_size_questions_small": "20", "font_size_answers_small": "20", "font_size_questions_large": "25", "font_size_answers_large": "25", "includeAds": "0", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [] }, { "itemId": "BwrBreakerRelay40", "itemType": "NAD_advanced_quiz", "itemNickname": "Breakers_bwr_40", "navBarTitleText": "40", "navBarStyle": "solid", "number_of_questions": "40", "randomize_question_order": "1", "show_correct_answers": "1", "show_incorrect_answers": "1", "delay_between_questions": "2", "button_color_correct": "#5bac26", "button_color_incorrect": "#d81417", "show_timer": "1", "show_score_box": "1", "points_per": "1", "question_background_color": "#FFFFFF", "button_color_answers": "#FFFFFF", "enableGameCenter": "0", "share_via_email": "1", "emailScoreSubject": "NRCGenericFundamentalsPracticeExam", "emailScoreMessage": "http://nrcgfe.com", "share_via_tmFB": "1", "tmFBText": "NRCGenericFundamentalsPracticeExam", "tmFBImageName": "Icon-72.png", "tmFBURL": "http://nrcgfe.com", "share_via_tmTWT": "1", "tmTWTText": "NRCGenericFundamentalsPracticeExam", "tmTWTImageName": "Icon-72.png", "tmTWTURL": "http://nrcgfe.com", "share_via_atTWT": "0", "dataURL": "Breakers_relays_and_disconnects_bwr_img.txt", "text_just": "left", "font_size_questions_small": "20", "font_size_answers_small": "20", "font_size_questions_large": "25", "font_size_answers_large": "25", "includeAds": "0", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [] }, { "itemId": "BwrBreakerRelay50", "itemType": "NAD_advanced_quiz", "itemNickname": "Breakers_bwr_50", "navBarTitleText": "50", "navBarStyle": "solid", "number_of_questions": "50", "randomize_question_order": "1", "show_correct_answers": "1", "show_incorrect_answers": "1", "delay_between_questions": "2", "button_color_correct": "#5bac26", "button_color_incorrect": "#d81417", "show_timer": "1", "show_score_box": "1", "points_per": "1", "question_background_color": "#FFFFFF", "button_color_answers": "#FFFFFF", "enableGameCenter": "0", "share_via_email": "1", "emailScoreSubject": "NRCGenericFundamentalsPracticeExam", "emailScoreMessage": "http://nrcgfe.com", "share_via_tmFB": "1", "tmFBText": "NRCGenericFundamentalsPracticeExam", "tmFBImageName": "Icon-72.png", "tmFBURL": "http://nrcgfe.com", "share_via_tmTWT": "1", "tmTWTText": "NRCGenericFundamentalsPracticeExam", "tmTWTImageName": "Icon-72.png", "tmTWTURL": "http://nrcgfe.com", "share_via_atTWT": "0", "dataURL": "Breakers_relays_and_disconnects_bwr_img.txt", "text_just": "left", "font_size_questions_small": "20", "font_size_answers_small": "20", "font_size_questions_large": "25", "font_size_answers_large": "25", "includeAds": "0", "backgroundImageNameSmallDevice": "chrom.png", "backgroundImageNameLargeDevice": "chrom_pad.png", "backgroundImageScale": "center", "childItems": [] } ----------------------------------------------------------------------------- The key here is to use the Snippet Keeper Plugin to layout your BT_config file. http://idevdepot.com/video-json-snippet-keeper-plugin-introduction/ Another good option is the circle view list menu.
 
Craig Conover
Aspiring developer
Profile
Posts: 56
Reg: Jan 01, 2013
Menlo Park, CA
4,310
like
06/03/13 10:02 PM (12 years ago)
Thanks nadthevlad - I have been needing to dig into the snippet keeper. I am sure I could make use of it in many ways. Thanks for the pointers. I will review the URL and your circle menu. Cheers.
 
feraco
Aspiring developer
Profile
Posts: 705
Reg: Jan 23, 2012
nyc
15,050
like
06/21/13 05:11 AM (12 years ago)
OK i am self hosted and the app keeps crashing when a go to the nad quiz screen. I made sure the images were with in the limits of length and width. Here what x code says 2013-06-21 08:05:10.571 demoapp[12145:c07] *** Terminating app due to uncaught exception 'NSGenericException', reason: 'Unable to install constraint on view. Does the constraint reference something from outside the subtree of the view? That's illegal. constraint:<NSLayoutConstraint:0xc8a8580 UILabel:0xc89f940.centerX == UIView:0xc89dd80.centerX> view:<UIView: 0xc89e0e0; frame = (0 0; 320 416); autoresize = W+H; layer = <CALayer: 0xc897290>>' *** First throw call stack: (0x382c012 0x3625e7e 0x382bdeb 0x1a554a0 0x222683e 0x2226a27 0x2226b76 0x2226d3b 0x2226c4d 0x14a36d 0x13a3db 0x13fc1f 0x13f0f7 0x13af45 0x18a05b3 0x37eb376 0x37eae06 0x37d2a82 0x37d1f44 0x37d1e1b 0x3bab7e3 0x3bab668 0x1cecffc 0x4aaa6 0x2c55) libc++abi.dylib: terminate called throwing an exception (lldb) Help please I dont know why its crashing.
 
SmugWimp
Smugger than thou...
Profile
Posts: 6316
Reg: Nov 07, 2012
Tamuning, GU
81,410
like
06/21/13 05:21 AM (12 years ago)
I know why; it's the auto layout. Auto layout allows the xib (user interface) file to compress/stretch elements depending on the kind of device you're working on... But I don't know what to do about it. Nad will be along shortly; he'll be able to get his head around it... Cheers! -- Smug
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
06/21/13 01:35 PM (12 years ago)
Hey feraco, I sent you a PM. There is a bug in the code. https://www.buzztouch.com/forum/thread.php?tid=37569D75161A718EECD899B&command=isSearching&currentPage=1&topicTitle=NAD&createdBy=&repliedBy=&minViews=-1&maxViews=-1&minReplies=-1&maxReplies=-1&forumCategory= It will require a little bit of cut and paste but it should be fairly easy to fix. Line 2728-2738 looks like this constraint = [NSLayoutConstraint constraintWithItem:_qOuterLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:_questionView attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]; [self.view addConstraint:constraint]; Your going to want to wrap this code in an if statement: like so: if(_qOuterLabel.superview != nil){ constraint = [NSLayoutConstraint constraintWithItem:_qOuterLabel attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:_questionView attribute:NSLayoutAttributeCenterX multiplier:1.0f constant:0.0f]; [self.view addConstraint:constraint]; }
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.