Control may reach end of non-void function error if-statement

后端 未结 5 392
[愿得一人]
[愿得一人] 2021-01-20 06:48

I\'m getting the error Control may reach end of non-void function on this code:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInte         


        
5条回答
  •  粉色の甜心
    2021-01-20 07:42

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        NSInteger count = 0;
        if (changeData.selectedSegmentIndex == 0) {
            count = self.tweets.count;
        } else if (changeData.selectedSegmentIndex == 1) {
            count = self.tweets1.count;
        } else {
            count = self.tweets2.count;
        }
       return count;
    }
    

    or

    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
       {
             NSInteger count = 0;
         if (changeData.selectedSegmentIndex == 0) {
            count = self.tweets.count;
         } else if (changeData.selectedSegmentIndex == 1) {
            count = self.tweets1.count;
         } 
         else if (changeData.selectedSegmentIndex == 2){
                count =  self.tweets2.count;
         }
         return count;
       }
    

提交回复
热议问题