我有一个价值100023,我已经接受了NSString.
现在我想在包含长参数类型的Web服务中传递此值,以便如何将字符串值转换为long.
好吧,直到几天后,我用它来代码都UITableViewCell在
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
方法.但最近我发现iPhone开发人员(或mac)使用configureCell:atIndexPath:甚至大多数苹果提供的源代码都将此作为其中一个类功能.所以我的问题基本上是为什么我们想创建一个更多的函数来提供单元格内容然后只是在cellForRowAtIndexPath:方法中编写整个代码.
PS.对于那些不熟悉这个的人,你应该看到苹果源代码.并且configureCell:atIndexPath:不是UITableViewDatasource中的另一个方法,它只是一个类函数,我们在每个具有表视图的类中都有.我们就这样使用它.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:CellIdentifier] autorelease];
}
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
cell.titleLabel.text = [NSString stringWithFormat:@"%d",indexPath.row];
}
Run Code Online (Sandbox Code Playgroud)
更重要的是,在将这种风格用于试用之后,我爱上了这个功能,现在我一直都在使用它.(当我使用UITableView时)
编辑:好的我认为人们对我的问题有错误的想法,所以让我说清楚一点.
我想为什么要在将此代码放入此函数时创建另一个函数
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
Run Code Online (Sandbox Code Playgroud)
我不关心方法名称.
UIBarButtonItem *doneitem=[[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(donePressed:)]autorelease];
self.navigationItem.rightBarButtonItem=doneitem;
Run Code Online (Sandbox Code Playgroud)
这是我的应用程序的代码,我需要在此按钮上添加图像?
请帮我.
我有一个UIButton设置并像往常一样连接到我的视图控制器中的动作.只是这个本身工作正常.
现在,我已将以下内容添加到我的视图控制器中以设置单击:
- (void)viewDidLoad {
[super viewDidLoad];
UITapGestureRecognizer * singleTapGesture = [[UITapGestureRecognizer alloc]
initWithTarget:self
action:@selector(handleSingleTap:)];
[self.view addGestureRecognizer:singleTapGesture];
[singleTapGesture release]; }
Run Code Online (Sandbox Code Playgroud)
现在,每次点击按钮时,它看起来都被轻敲,但它会触发手势识别器代码而不是按钮动作.
当我点击按钮时,我如何才能使按钮工作,当我点击视图中的任何其他位置时,点击手势可以正常工作?
我一直在搜索google上的教程,在google plus上发布一些文字.但似乎没有.
我也尝试通过谷歌为mac和iPhone的开发者提供的文档,但找不到任何可以解决我的问题.此外,关于如何让用户登录google plus帐户的信息很少.
我不知道该怎么做用户登录,我是否必须使用一些GTLObject或使用UIWebView如foursquare进行用户登录.
这是我经历过的文档列表.
http://code.google.com/p/google-api-objectivec-client/wiki/Introduction
http://code.google.com/p/google-api-objectivec-client/wiki/BuildingTheLibrary
http:// code.google.com/p/gtm-oauth2/
我想开发一个应用程序,其功能与iphone电话簿捕获图像和选择iamge相同,
我该怎么做才能做到这一点
我为UIActionSheet制作了一个UIImageView和一个按钮,
现在我想在我的应用程序中执行"拍照"和"选择现有照片"选项
帮助我,我很感激
提前致谢 ....
我已经在这个iPhone应用程序上工作了一段时间,我已经完成了它的工作.我正在扩展的项目是从我在线的subversion存储库下载的,我的教授也给了我访问权限.我不小心没有下载"root"副本或类似的东西,所以我无法对存储库进行任何更改.在我的教师帮助下,我今天下载了根拷贝并将所有类文件添加到其中,以便我可以提交更改.但是,我现在遇到了3个我以前从未见过的奇怪错误:
未定义的符号:
"_OBJC_CLASS _ $ _ mapListViewController",引用自:mapViewController.o中的objc-class-ref-to-mapListViewController
"_OBJC_CLASS_$_mapParser", referenced from: objc-class-ref-to-mapParser in mapViewController.o
"_OBJC_CLASS_$_mapTabViewController", referenced from: objc-class-ref-to-mapTabViewController in mapViewController.o
ld: symbol(s) not found collect2: ld returned 1 exit status
That is the exact error message I am getting. I have not changed any code from the version that was working completely earlier this morning. Any advice? The mapViewController file seems to be what is causing the issue, so here is that as well:
#import "mapViewController.h"
#import "locationDetailViewController.h"
#import "DPUAnnotation.h"
#import …Run Code Online (Sandbox Code Playgroud) tableView:numberOfRowsInSection填充表视图时应该调用该方法多少次?
我的应用程序崩溃,没有警告,错误或堆栈跟踪.我还测试了内存泄漏,但没有找到.该应用程序稳定在1.4MB左右.
我有NSLog报告方法是消息,我注意到tableView:numberOfRowsInSection被多次调用.应用程序在其中一个"额外"调用期间崩溃.应用程序崩溃的点会有所不同.我应该指出,如果这有所不同,该表填充了大约600个单元格.
我可以根据需要发布代码,但我的数据源来自a singleton class,所以代码很多.任何帮助将不胜感激.
在我们的iPad-App中,我们使用UIWebView从一个域加载不同的站点,其中一些使用hml5-Video加载.没有视频的网站可以完美加载.但是当我加载包含htmlt5-video的网站时,有时我的应用程序在使用EXC_BAD_ACCESS的UIWebView的加载过程中崩溃,有时它不会.每当发生这样的崩溃时,似乎发生在将视频播放器添加到站点中的位置.
我确实从Apple下载了UICatalog-Example,并且确实将WebViewController-Class中的Default-URL更改为包含html5-video的站点的URL.结果相同......有时崩溃有时不会崩溃.
我还在Xcode(基于视图的应用程序 - 用于iPad)上创建了一个新项目,并且只在新的Projects ViewController中添加了一个UIWebView.再次......加载包含html5-video的网站有时会导致崩溃,有时甚至不会.
"新项目"视图控制器代码(实施):
- (void)viewDidLoad {
[super viewDidLoad];
self.myWebView = [[[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 768, 1004)] autorelease];
self.myWebView.backgroundColor = [UIColor whiteColor];
self.myWebView.scalesPageToFit = YES;
self.myWebView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
self.myWebView.delegate = self;
[self.view addSubview: self.myWebView];
[self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.gelbeseiten.de/129103114849"]]];
//More Sites with HTML5-Videos ...
//[self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.gelbeseiten.de/129103746403"]]];
//[self.myWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.gelbeseiten.de/129105233646"]]];
}
- (void)viewDidUnload {
[super viewDidUnload];
self.myWebView = nil;
}
- (void)viewWillDisappear:(BOOL)animated {
[self.myWebView stopLoading];
}
- (void)dealloc {
myWebView.delegate = nil;
[myWebView release]; …Run Code Online (Sandbox Code Playgroud) 我必须在手指触摸上循环旋转视图...我的意思是像拨打旧手机号码......触摸应该只在角落.....任何人都可以帮助我...我试过它很多......但没有成功

iphone ×8
objective-c ×8
ios ×2
uiimageview ×2
uitableview ×2
xcode ×2
capture ×1
cocoa-touch ×1
google-plus ×1
html5-video ×1
ios4 ×1
long-integer ×1
nsstring ×1
oauth-2.0 ×1
reference ×1
rotation ×1
subview ×1
uibutton ×1
uikit ×1
uiwebview ×1