我试图使用此代码获取节标题视图:
[tableView headerViewForSection:indexPath.section];
Run Code Online (Sandbox Code Playgroud)
但是这段代码总是让我失败.你能给我一些例子来从表视图中获取节头视图吗?这是我的viewForHeader实现:
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
DynamicHeader *headerView = [[DynamicHeader alloc] init];
headerView.frame = CGRectMake(0, 0, 320, 40);
UILabel *headerLbl = [[UILabel alloc] init];
headerLbl.frame = CGRectMake(10, 10, 300, 20);
if(((SectionViewController *)sharedInstance.currentViewController).currentSectionType == 25)
{
UIImageView *imgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"minus.png"]];
imgView.frame = CGRectMake(285, 14.5, 16, 13);
[headerView addSubview:imgView];
UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:sharedInstance action:@selector(headerTap:)];
[headerView addGestureRecognizer:recognizer];
headerView.tableView = tableView;
headerView.heightForRows = 95;
headerView.isOpen = YES;
}
headerLbl.text = [[[[[((SectionViewController *)sharedInstance.currentViewController).responseDictionary valueForKey:DATA_PARAMETER] valueForKey:SECTION_TABLE_PARAMETER] objectAtIndex:section] …Run Code Online (Sandbox Code Playgroud) 如何使用SLRequest将UIImage附加到Facebook上的帖子.这是我的代码:
SLRequest *facebookRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodPOST
URL:[NSURL URLWithString:@"https://graph.facebook.com/me/feed"]
parameters:[NSDictionary dictionaryWithObject:post forKey:@"message"]];
Run Code Online (Sandbox Code Playgroud)
我知道有必要在参数中指定图片,但我不知道它要做什么.
我正在尝试实现iOS 6日历中的事件表.
我有UITableView 500行(事件).当我开始滚动动画是顺利的.
但是在两百行开始滞后之后.在原生iOS 6日历事件列表中,所有工作都顺利进行
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
double begin = CFAbsoluteTimeGetCurrent();
if(!self.isNoResults)
{
NSString *cellIdentifier = [NSString stringWithFormat: @"Cell %i %i", indexPath.row, indexPath.section];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
UIImageView *circleImgView;
NSString *startTimeStr;
NSDateFormatter *formatter;
UILabel *timeLbl;
UILabel *titleLbl;
UILabel *endsLbl;
UIImageView *eventTypeImgView;
if(cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
circleImgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"newMesIcon.png"]];
circleImgView.frame = CGRectMake(14, 19, 12, 12);
[cell.contentView addSubview:circleImgView];
timeLbl = [[UILabel alloc] init];
[timeLbl setBackgroundColor:[UIColor clearColor]]; …Run Code Online (Sandbox Code Playgroud) 我如何在静态方法中设置委托和dataSource .
+(void)method
{
UITableView *tv = [[UITableView alloc] init];
tv.delegate = self; // Warning: incompatible pointer type
tv.dataSource = self; // Warning: incompatible pointer type
}
Run Code Online (Sandbox Code Playgroud)