分段控制不调用方法

 mobiledu2502885807 发布于 2023-02-11 19:57

我在实施分段控制时遇到了麻烦.我相信我已经连接了所有内容,但是当我点击分段控件的任一侧时,该方法没有被调用.

头文件

    #import 
#import "ServiceConnector.h"
#import 
#import 
#import 
#import "Global.h"

@interface ContactInfo : NSObject

@property char group;
@property (nonatomic, retain) NSString* firstName;
@property (nonatomic, retain) NSString* lastName;
@property (nonatomic, retain) NSString* phoneNumber;
@property int isSelected;

@end

@interface Friends : UIViewController{
    UISegmentedControl *segmentedControl;
}

@property (nonatomic, retain) IBOutlet UITableView* tblFriends;
@property (nonatomic, retain) IBOutlet UIButton* btnAdd;
@property (nonatomic, retain) IBOutlet UIButton* btnInvite;
@property (nonatomic, retain) IBOutlet UIButton* btnDone;

@property (nonatomic, retain) NSMutableArray* contactList;
@property (nonatomic, retain) NSMutableArray* contactGroup;
@property (nonatomic, retain) NSMutableArray* friendList;
@property (nonatomic, retain) NSString* modeStr;

@property (nonatomic,retain) IBOutlet UISegmentedControl *segmentedControl;

- (IBAction) InviteClicked;
- (IBAction) AddClicked;
- (IBAction) DoneClicked;
- (IBAction)segmentSwitch;
- (void) sendSMS:(NSString*) phoneNumber;
- (void) sendInviteSMS:(NSMutableArray*) resipients;
- (void) getContacts;
- (void) groupFromContacts;
- (void) groupFromFriends;

// table delegates
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;

// service connector delegate
- (void)requestReturnedData:(NSData*)data;

//message delegate
- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result;

@end

简化版的实现(方法已被删除)

    #import "Friends.h"
#import "JSONKit.h"

@interface Friends ()

@end

@implementation ContactInfo

@end

@implementation Friends
@synthesize segmentedControl;




- (void)viewDidLoad
{
    _friendList = [[NSMutableArray alloc] init];
    _contactList = [[NSMutableArray alloc] init];
    [self AddClicked];
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void) dealloc
{
    [segmentedControl release];
    [_friendList release];
    [_contactList release];
    [super dealloc];
}

- (IBAction)segmentSwitch {
    switch (self.segmentedControl.selectedSegmentIndex) {
        case 0:
            [self AddClicked];
            break;
        case 1:
            [self InviteClicked];
            break;

        default:
            break;
    }

}

@end

这是分段控制的连接检查器

连接检查员

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有