我有两个UITextField盒子,一个用于minPrice,一个用于maxPrice.当我尝试运行由submitButton IBAction这两个文本字段内容作为参数触发的函数时,它声明对象为空,并出现以下错误:
'*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
我似乎无法弄清楚为什么输入这些字段的文本没有正确保存.当我以编程方式初始化它时,我忘记了什么吗?
CriteriaViewController.h:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import "SearchViewController.h"
@interface CriteriaViewController : UIViewController{
IBOutlet UISegmentedControl *Segment;
}
//@property (nonatomic) IBOutlet UITextField *itemSearch;
@property (weak, nonatomic) IBOutlet UITextField *minPrice;
@property (weak, nonatomic) IBOutlet UITextField *maxPrice;
@property (nonatomic, copy) NSNumber *chosenCategory;
@property (nonatomic, copy) NSString *chosenCategoryName;
@property (weak, nonatomic) NSString *itemCondition;
@property (weak, nonatomic) NSString *itemLocation;
@property (weak, nonatomic) NSString *itemSearch;
@end
Run Code Online (Sandbox Code Playgroud)
CriteriaViewController.m:
#import "CriteriaViewController.h"
@interface CriteriaViewController …Run Code Online (Sandbox Code Playgroud) 我目前的行高设置如下:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == self.expandedSection || indexPath.row <= 3) {
return 65;
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我基本上只希望前4行在默认情况下可见,除非该部分是扩展形式,在这种情况下所有行都是可见的.我这样做是通过设置前4到65的行高,其余的为0.行和它们各自的图像没有显示,但是cell.textLabel和cell.detailTextLabels是,导致它们看起来像下面的图片.
如何禁用这两个,以便它们不会显示在第4行的任何行?

我想SearchCategoryChooserViewController成为它的子类SearchViewController,并设置如下:
SearchCategoryChooserViewController.h:
#import <UIKit/UIKit.h>
#import "SearchViewController.h"
@interface SearchCategoryChooserViewController : SearchViewController
@end
Run Code Online (Sandbox Code Playgroud)
SearchViewController.h:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import <Parse/PFCloud.h>
#import "CriteriaViewController.h"
@interface SearchViewController : UIViewController
@property (weak, nonatomic) IBOutlet UIButton *nextButtonOutlet;
@property (weak, nonatomic) NSString *topCategory1;
@property (weak, nonatomic) NSString *topCategory2;
@end
Run Code Online (Sandbox Code Playgroud)
当我尝试运行应用程序时,它会给我以下错误:
Ld /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator/Parse+Storyboard.app/Parse+Storyboard normal i386
cd /Users/Andrew/OneDrive/Dev/Parse---Storyboard
export IPHONEOS_DEPLOYMENT_TARGET=7.1
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.1.sdk -L/Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator -F/Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Products/Debug-iphonesimulator -F/Users/Andrew/OneDrive/Dev/Parse---Storyboard -filelist /Users/Andrew/Library/Developer/Xcode/DerivedData/Parse+Storyboard-erplilyduxqrboclmgotnylnvcux/Build/Intermediates/Parse+Storyboard.build/Debug-iphonesimulator/Parse+Storyboard.build/Objects-normal/i386/Parse+Storyboard.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=7.1 -framework AdSupport -framework Accounts -framework …Run Code Online (Sandbox Code Playgroud) 我的UITableView显示从云代码函数返回的JSON信息.出于某种原因,它正确显示了要返回的项目的标题,但我无法将其显示为每个单元格的副标题.设置样式UITableViewCellStyleSubtitle似乎不起作用,并给我一个警告说明Implicit conversion from enumeration type 'enum UITableviewCellStyle' to different enumeration type.
MatchCenterViewController.h:
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
#import "AsyncImageView.h"
#import "SearchViewController.h"
@interface MatchCenterViewController : UIViewController <UITableViewDataSource>
@property (nonatomic) IBOutlet NSString *itemSearch;
@property (nonatomic, strong) NSArray *imageURLs;
@property (strong, nonatomic) NSString *matchingCategoryCondition;
@property (strong, nonatomic) NSString *matchingCategoryLocation;
@property (strong, nonatomic) NSNumber *matchingCategoryMaxPrice;
@property (strong, nonatomic) NSNumber *matchingCategoryMinPrice;
@property (strong, nonatomic) NSArray *matchCenterArray;
@end
Run Code Online (Sandbox Code Playgroud)
MatchCenterViewController.m:
#import "MatchCenterViewController.h"
#import <UIKit/UIKit.h>
@interface MatchCenterViewController () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *matchCenter; …Run Code Online (Sandbox Code Playgroud) 我的UITextField故事板中有两个s用于输入用户输入的数字,minPrice和maxPrice.当我在模拟器中单击提交时,应用程序崩溃,我收到以下错误:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[3]'
*** First throw call stack:
(
0 CoreFoundation 0x02a881e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x026468e5 objc_exception_throw + 44
2 CoreFoundation 0x02a4e376 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 390
3 CoreFoundation 0x02a7bc29 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 73
4 Parse+Storyboard 0x0000b5b5 -[CriteriaViewController submitButton:] + 757
5 libobjc.A.dylib 0x02658880 -[NSObject performSelector:withObject:withObject:] + 77
6 UIKit 0x013083b9 -[UIApplication sendAction:to:from:forEvent:] + 108
7 UIKit 0x01308345 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + …Run Code Online (Sandbox Code Playgroud) 我已经尝试过使用ASyncImageView来实现这个目的,但是我对于如何根据具体情况实现它有点困惑.我目前有一个MatchCenterViewController包含一个表的内容.它正在同步加载单元格的图像,这在滚动表格时会导致很多延迟.如何修改我加载远程图像的方式,以便异步完成?我的代码如下:
#import "MatchCenterViewController.h"
#import <UIKit/UIKit.h>
#import "MatchCenterCell.h"
@interface MatchCenterViewController () <UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) UITableView *matchCenter;
@property (nonatomic, assign) BOOL matchCenterDone;
@property (nonatomic, assign) BOOL hasPressedShowMoreButton;
@end
@implementation MatchCenterViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
_matchCenterDone = NO;
_hasPressedShowMoreButton = NO;
// Set up MatchCenter table
self.matchCenter = [[UITableView alloc] initWithFrame:self.view.bounds style:UITableViewCellStyleSubtitle];
self.matchCenter.frame = CGRectMake(0,70,320,self.view.frame.size.height-100);
self.edgesForExtendedLayout = UIRectEdgeAll; …Run Code Online (Sandbox Code Playgroud) 我在视图控制器中有一个UITableView设置,用于填充函数返回的JSON数据.当我加载MatchCenterViewController时,应用程序崩溃,我收到以下错误:
2014-06-07 15:56:23.651 Parse+Storyboard[6848:607] -[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0xaa29730
2014-06-07 15:56:23.825 Parse+Storyboard[6848:607] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView tableView:numberOfRowsInSection:]: unrecognized selector sent to instance 0xaa29730'
*** First throw call stack:
(
0 CoreFoundation 0x02a8c1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x0264a8e5 objc_exception_throw + 44
2 CoreFoundation 0x02b29243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x02a7c50b ___forwarding___ + 1019
4 CoreFoundation 0x02a7c0ee _CF_forwarding_prep_0 + 14
5 UIKit 0x0156f94c -[UISectionRowData refreshWithSection:tableView:tableViewRowData:] + 2510
6 UIKit 0x0157323d -[UITableViewRowData …Run Code Online (Sandbox Code Playgroud)