小编Chr*_*ien的帖子

单击UITableView中的Event

我有一个按钮和表.现在我想以这样的方式点击:每当我选择任何一行tableview并按下按钮时,该特定按钮按下事件就会发生.为此,首先我给每一行标记,即

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *LabelCellIdentifier = @"cell";
UITableViewCell *cell;
cell = [tableView dequeueReusableCellWithIdentifier:LabelCellIdentifier];
if (cell == nil) {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:LabelCellIdentifier];


}

if (indexPath.row <= [_arrayMp3Link count]) {

    cell.textLabel.text = [_arrayMp3Link objectAtIndex:indexPath.row];

     }

// now tag each row
NSInteger count = 1;
for (NSInteger i = 0; i < indexPath.section; i++) {
    count += [[tableView dataSource] tableView:tableView numberOfRowsInSection:i];
}
count += indexPath.row;
// dequeue, create and configure...
cell.tag = …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c uitableview tableview ios

21
推荐指数
2
解决办法
4万
查看次数

在Facebook-Ios-Sdk关闭Facebook会话

如何关闭aCtive Session Facebook-iOS-Sdk每当我在杀死应用程序后启动我的应用程序时,它会给我之前的登录会话详细信息.当我点击facebook按钮时.我已经使用了所有内容[appDelegate.session closeAndClearTokenInformation]; [FBSession.activeSession close]; [FBSession.activeSession closeAndClearTokenInformation]..但是活动会话仍然没有关闭.如何关闭以前的会话数据点击.

我使用下面的代码清除,但每当我点击Facebook按钮开始新的会话..它给我回到以前的凭据.

- (IBAction)buttonClickHandler:(id)sender {

appDelegate = [[UIApplication sharedApplication]delegate];

// this button's job is to flip-flop the session from open to closed
if (appDelegate.session.isOpen) {

    [appDelegate.session closeAndClearTokenInformation];
    [FBSession.activeSession close];
    [FBSession.activeSession  closeAndClearTokenInformation];
    FBSession.activeSession=nil;

} else {
    if (appDelegate.session.state != FBSessionStateCreated) {
        // Create a new, logged out session.
        appDelegate.session = [[FBSession alloc] init];
    }

    // if the session isn't open, let's open it now and present the login UX to the …
Run Code Online (Sandbox Code Playgroud)

iphone facebook facebook-graph-api ios

11
推荐指数
1
解决办法
2万
查看次数

如何更改UITableView节颜色和文本颜色

我有UITableView从plist填充日期和Even部分的标题已经从plist填充.UITableView它给我默认的blue部分颜色和White文本颜色.像这样......

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


NSString *key = nil;
if ([tableView isEqual:self.searchDisplayController.searchResultsTableView])
{
    key = [self.searchResults objectAtIndex:section];
}
else{
    key = [self.mySections objectAtIndex:section];
}

//    NSString *key = [self.mySections objectAtIndex:section];
return [NSString stringWithFormat:@"%@", key];

 }
Run Code Online (Sandbox Code Playgroud)

.现在我需要更改此默认文本颜色和Section的颜色,为此我正在实现下面显示的代码.但它给了我自己的代码UIView.

-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *tempView=[[UIView alloc]initWithFrame:CGRectMake(0,200,300,244)];
    tempView.backgroundColor=[UIColor clearColor];

    UILabel *tempLabel=[[UILabel alloc]initWithFrame:CGRectMake(15,0,300,44)];
    tempLabel.backgroundColor=[UIColor clearColor]; 
    tempLabel.shadowColor = [UIColor blackColor];
    tempLabel.shadowOffset = CGSizeMake(0,2);
    tempLabel.textColor = [UIColor redColor]; //here you can change the text color …
Run Code Online (Sandbox Code Playgroud)

xcode uitableview ios

4
推荐指数
1
解决办法
1万
查看次数

Objective-C正则表达式

我需要在Objective C中使用正则表达式接受male或者female只接受..应该是case-Insensitive接受更低和更高的手段.我经历了苹果文档.. 并在代码下面实现但不工作...

- > 男性或女性只能被接受

-(BOOL)genderValidate:(NSString *)string{

NSError *error=nil;

NSRegularExpression *regex =[NSRegularExpression regularExpressionWithPattern:@"\\b (m|f)(a|e)(l|m)(e|a)(l)(e) \\b" options:(NSRegularExpressionCaseInsensitive) error: &error];
NSUInteger numberofmatches =[regex numberOfMatchesInString:string options:0 range:NSMakeRange(0,[string length])];

return numberofmatches;


}
Run Code Online (Sandbox Code Playgroud)

regex iphone objective-c ios nsregularexpression

0
推荐指数
1
解决办法
407
查看次数