Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 方法调用的参数太多,应为1,但有2?(Xcode)_Ios_Objective C_Xcode_Arguments - Fatal编程技术网

Ios 方法调用的参数太多,应为1,但有2?(Xcode)

Ios 方法调用的参数太多,应为1,但有2?(Xcode),ios,objective-c,xcode,arguments,Ios,Objective C,Xcode,Arguments,还有许多其他类似的问题,但缺乏答案,而且每个项目的答案各不相同。 我有这个错误 '方法调用的参数太多,应为1,但有2个?' 但是在我以前使用的阵列上,没有发生此错误?代码可能有问题,但我不确定?我一直在寻找可能影响它的其他错误,但没有运气。 下面是我的代码 #import "MenuViewController.h" #import "ECSlidingViewController.h" @interface MenuViewController () @property (strong,

还有许多其他类似的问题,但缺乏答案,而且每个项目的答案各不相同。 我有这个错误 '方法调用的参数太多,应为1,但有2个?' 但是在我以前使用的阵列上,没有发生此错误?代码可能有问题,但我不确定?我一直在寻找可能影响它的其他错误,但没有运气。 下面是我的代码

#import "MenuViewController.h"
#import "ECSlidingViewController.h"

@interface MenuViewController ()

@property (strong, nonatomic) NSArray *menu;
@property (strong, nonatomic) NSArray *section1;
@property (strong, nonatomic) NSArray *section2;
@property (strong, nonatomic) NSArray *section3;


@end

@implementation MenuViewController

@synthesize menu, section1, section2, section3;


- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    // self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;

    self.section1 = [NSArray arrayWithObjects:@"News Feed", @"Buy Shares", @"Sell Shares", nil];

    self.section2 = [NSArray arrayWithObjects:@"Finances", @"Current Holdings", @"Trading History", nil];

    ***self.section3 = [NSArray arrayWithObject:@"Leaderboard", nil];***

    self.menu = [NSArray arrayWithObjects:self.section1, self.section2, self.section3, nil];


    [self.slidingViewController setAnchorRightRevealAmount:200.0f];
    self.slidingViewController.underLeftWidthLayout = ECFullWidth;

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
#warning Potentially incomplete method implementation.
    // Return the number of sections.
    return [self.menu count];
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
#warning Incomplete method implementation.
    // Return the number of rows in the section.

    if (section == 0) {

        return [self.section1 count];

    } else if (section == 1) {

        return [self.section2 count];

    } else if (section == 2) {

        return  [self.section3 count];

    }


}


-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {


    if (section == 0) {

        return @"Stock Market";

    } else if (section == 1) {

        return @"Portfolio";

    } else if (section == 2) {

        return  @"Options";

    }


}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
    }

    if (indexPath.section == 0) {

        cell.textLabel.text = [NSString stringWithFormat:@"%@", [self.section1 objectAtIndex:indexPath.row]];

    } else if (indexPath.section == 1) {


        cell.textLabel.text = [NSString stringWithFormat:@"%@", [self.section2 objectAtIndex:indexPath.row]];
    } else if (indexPath.section == 2) {


        cell.textLabel.text = [NSString stringWithFormat:@"%@", [self.section3 objectAtIndex:indexPath.row]];
    }





    return cell;
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }   
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }   
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

#pragma mark - Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Navigation logic may go here. Create and push another view controller.
    /*
     <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
     // ...
     // Pass the selected object to the new view controller.
     [self.navigationController pushViewController:detailViewController animated:YES];

     */

    UIViewController *newTopViewController;


    if (indexPath.section == 0) {

        NSString *identifier = [NSString stringWithFormat:@"%@", [self.section1 objectAtIndex:indexPath.row]];

        newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];

    } else if (indexPath.section == 1) {

        NSString *identifier = [NSString stringWithFormat:@"%@", [self.section2 objectAtIndex:indexPath.row]];

        newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];

    } else if (indexPath.section == 2) {

        NSString *identifier = [NSString stringWithFormat:@"%@", [self.section3 objectAtIndex:indexPath.row]];

        newTopViewController = [self.storyboard instantiateViewControllerWithIdentifier:identifier];

    }




    [self.slidingViewController anchorTopViewOffScreenTo:ECRight animations:nil onComplete:^{
        CGRect frame = self.slidingViewController.topViewController.view.frame;
        self.slidingViewController.topViewController = newTopViewController;
        self.slidingViewController.topViewController.view.frame = frame;
        [self.slidingViewController resetTopView];
    }];


}

@end
#导入“MenuViewController.h”
#导入“ECSlidingViewController.h”
@接口菜单ViewController()
@属性(强,非原子)NSArray*菜单;
@性质(强、非原子)NSArray*第1节;
@性质(强、非原子)NSArray*第2节;
@性质(强、非原子)NSArray*第3节;
@结束
@实现菜单iewcontroller
@综合菜单,第1节,第2节,第3节;
-(id)initWithStyle:(UITableViewStyle)样式
{
self=[super initWithStyle:style];
如果(自我){
//自定义初始化
}
回归自我;
}
-(无效)viewDidLoad
{
[超级视图下载];
//取消对下一行的注释以保留演示文稿之间的选择。
//self.clearselectiononviewwillappear=否;
//取消对以下行的注释,以在此视图控制器的导航栏中显示编辑按钮。
//self.navigationItem.rightBarButtonItem=self.editButtonItem;
self.section1=[NSArray数组,其对象为:@“新闻提要”@“购买股票”@“出售股票”,无];
self.section2=[NSArray阵列,其对象为:@“财务状况”@“当前持有量”@“交易历史”,无];
***self.section3=[NSArray阵列WithObject:@“排行榜”,无]***
self.menu=[NSArray数组,其中包含对象:self.section 1、self.section 2、self.section 3、nil];
[self.slidingViewController setAnchorRightRevealAmount:200.0f];
self.slidingViewController.undereftwidthlayout=ECFullWidth;
}
-(无效)未收到记忆警告
{
[超级记忆警告];
//处置所有可以重新创建的资源。
}
#pragma标记-表视图数据源
-(NSInteger)表格视图中的节数:(UITableView*)表格视图
{
#警告:方法实现可能不完整。
//返回节数。
返回[自菜单计数];
}
-(NSInteger)表视图:(UITableView*)表视图行数节:(NSInteger)节
{
#警告:方法实现不完整。
//返回节中的行数。
如果(节==0){
返回[self.section1计数];
}else if(节==1){
返回[self.section2计数];
}否则如果(节==2){
返回[self.section3计数];
}
}
-(NSString*)表格视图:(UITableView*)表格视图标题标题标题部分:(NSInteger)部分{
如果(节==0){
返回"股票市场";;
}else if(节==1){
回报"投资组合;;
}否则如果(节==2){
返回@“选项”;
}
}
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
NSString*cellIdentifier=@“单元”;
UITableViewCell*单元格=[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
如果(单元格==nil){
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle重用标识符:cellIdentifier];
}
if(indexPath.section==0){
cell.textLabel.text=[NSString stringWithFormat:@“%@,[self.section1 objectAtIndex:indexath.row]];
}else if(indexPath.section==1){
cell.textLabel.text=[NSString stringWithFormat:@“%@,[self.section2 objectAtIndex:indexath.row]];
}else if(indexPath.section==2){
cell.textLabel.text=[NSString stringWithFormat:@“%@,[self.section3 objectAtIndex:indexath.row]];
}
返回单元;
}
/*
//替代以支持表视图的条件编辑。
-(BOOL)tableView:(UITableView*)tableView caneditrowatinexpath:(nsindepath*)indepath
{
//如果不希望指定的项可编辑,则返回“否”。
返回YES;
}
*/
/*
//替代以支持编辑表格视图。
-(void)tableView:(UITableView*)tableView提交的编辑样式:(UITableViewCellEditingStyle)行的编辑样式索引路径:(NSIndexPath*)索引路径
{
如果(editingStyle==UITableViewCellEditingStyleDelete){
//从数据源中删除该行
[tableView deleteRowsAtIndexPaths:@[indexPath]和RowAnimation:UITableViewRowAnimationFade];
}   
else if(editingStyle==UITableViewCellEditingStyleInsert){
//创建相应类的新实例,将其插入数组,并向表视图添加新行
}   
}
*/
/*
//替代以支持重新排列表视图。
-(void)tableView:(UITableView*)tableView移动rowatinexpath:(nsindepath*)从indepath到indepath:(nsindepath*)到indepath
{
}
*/
/*
//重写以支持表视图的条件重新排列。
-(BOOL)tableView:(UITableView*)tableView可以移动rowatinexpath:(nsindepath*)indepath
{
//如果不希望该项目可重新订购,则返回“否”。
返回YES;
}
*/
#pragma标记-表视图委托
-(void)tableView:(UITableView*)tableView未选择RowatineXpath:(NSIndexPath*)indexPath
{
//导航逻辑可能位于此处。创建并推送另一个视图控制器。
/*
*detailViewController=[[alloc]initWithNibName:@“bundle:nil];
// ...
//将选定对象传递给新的视图控制器。
[self.navigationController pushViewController:detailViewController动画:是];
*/
UIViewController*newTopViewController;
if(indexPath.section==0){
NSString*标识符=[NSString stringWithFormat:@“%@,[self.section1 objectAtIndex:indexath.row]];
newTopViewController=[self.storyboard实例化eviewcontrollerwhiteIdentifier:identifier];
}else if(indexPath.section==1){
NSString*标识符=[NSString stringWithFormat:@“%@,[self.section2 objectAtIndex:indexath.row]];
新视窗
[NSArray arrayWithObject:@"Leaderboard", nil];
[NSArray arrayWithObject: @"Leaderboard"];
[NSArray arrayWithObjects: @"Leaderboard", nil];