如何为类编写正确的描述方法?
我已经实施了
- (NSString *)description {
NSString *descriptionString = [NSString stringWithFormat:@"Name: %@ \n Address: %@ \n", self.name, self.address];
return descriptionString;
}
Run Code Online (Sandbox Code Playgroud)
如果我在我的对象上调用描述,Evrey的事情就好了.但是如果我有一个对象数组并且我在其上调用描述,我会得到:
"姓名:Alex \n地址:某地址\n",
我想得到的是
"姓名:亚历克斯
地址:一些地址"
我想禁用应用程序中的长触摸.我无法控制我在WebView上加载的HTML.
我想在图像上实现alpha渐变.从图像顶部的0.5 alfa到底部的0.0.欢迎任何建议,教程和链接.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
return YES;
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath{
return UITableViewCellEditingStyleDelete;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath{
if(editingStyle == UITableViewCellEditingStyleDelete){
//[theSimpsons removeObjectAtIndex:indexPath.row];
NSString *time = [[arrayList objectAtIndex:indexPath.row] objectForKey:@"TIME"];
NSString *date= [[arrayList objectAtIndex:indexPath.row] objectForKey:@"DATE"];
DBManager *dbm = [[DBManager alloc] init];
[dbm initiallzeDatabase];
[dbm deleteItemAtIndexPath:time :date];
//arrayList = [dbm getParkResults];
//[parkTableView reloadData];
[arrayList removeObjectAtIndex:indexPath.row];
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}
Run Code Online (Sandbox Code Playgroud)
我在我的应用程序中使用了上面的代码.编辑部分工作正常,但事实是,删除按钮仅在我们从单元格从左向右滑动时出现.现在我有一个菜单,可以像Facebook一样从左到右滑动.那么当用户从右向左滑动时,如何确保显示删除按钮.
有没有什么可以使代码完成反应更快?
我在mac mini 2010上有4gb Ram和iMac 21.5 i3 2010上的问题.
我有什么东西要让它更快地运作?或者只是我,我有这个问题?
有没有人有同样的问题?
我使用此代码尝试在iOS设备上启用扬声器.
pjmedia_aud_dev_route route = PJMEDIA_AUD_DEV_ROUTE_LOUDSPEAKER;
pj_status_t status = pjsua_snd_set_setting(PJMEDIA_AUD_DEV_CAP_INPUT_ROUTE, &route, PJ_FALSE);
if (status != PJ_SUCCESS){
NSLog(@"Error enabling loudspeaker");
}
Run Code Online (Sandbox Code Playgroud)
我知道我可以使用,kAudioSessionProperty_OverrideAudioRoute
但我想通过pjsip启用它,因为我可以传递PJMEDIA_AUD_DEV_ROUTE_BLUETOOTH
路由并启用蓝牙.
我在iOS 5.0上使用pjsip 1.8.5
我正在创建自定义单元格包含UILabel
,UIImageView
使用常量标记UILabel
,UIImageView
使用动态标记,表格有11个单元格,前7个单元格正确加载,8,9,10,11单元格图像视图在我更改1,2时更改,3,4,单元格分别在表格中,单元格中的标签也一样,我使用图片复选框表,UITapGestureRecognizer
用于更改表格中的imageview,
我正在使用此代码.....
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier =@"Cell";
UITableViewCell *cell = [tableview dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
cell.selectionStyle=UITableViewCellSelectionStyleGray;
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
UIImageView *imageview=[[UIImageView alloc]initWithFrame:CGRectMake(5, 12, 20, 20)];
imageview.tag=n;
[cell.contentView addSubview:imageview];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tabimage:)];
imageview.userInteractionEnabled=YES;
[imageview addGestureRecognizer:tap];
imageview.image=[UIImage imageNamed:@"img1.jpeg"];
UILabel *titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(30, 2, 260,26)];
titleLabel.tag=222;
titleLabel.backgroundColor=[UIColor clearColor];
[cell.contentView addSubview:titleLabel];
UILabel *dateLabel=[[UILabel alloc]initWithFrame:CGRectMake(30, 31, 260, 13)];
dateLabel.tag=333; …
Run Code Online (Sandbox Code Playgroud) 我想在ios上使用pjsip在正在进行的通话期间处理ip更改表格wifi到4g.
我已经按照pjsip网站的所有步骤进行了操作:https://trac.pjsip.org/repos/wiki/IPAddressChange 这里我发现呼叫在pjsua_acc_set_registration(the_acc_id, PJ_FALSE);
发送后已断开连接.另外,我不明白如何在第4点发送重新注册.
"最后,一旦在2b中取消注册)完成后,重新注册(使用TCP)."
任何建议,建议,链接到我将解决问题的任何资源都很好.
我的背景颜色是白色的!为什么?只需为iPad启动一个新的基于视图的应用程序,并在viewDidLoad中设置背景颜色.
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
}
Run Code Online (Sandbox Code Playgroud)
怎么了.如果我将它设置为redColor它可以工作.为什么?
我想以编程方式读取崩溃文件.我怎样才能做到这一点?
我被允许这样做?如果我这样做,我的申请会被拒绝吗?
任何建议,链接,教程都很好.