草庐IT

NSstring

全部标签

ios - 推特授权登录

我正在使用STTwitter在我正在为某人更改的iOS应用程序中与Twitter交互。当我第一次使用以下代码调用twitter授权页面时:-(void)newUser{[[NetworkManagersharedInstance]resetTwitterAPI];[[[NetworkManagersharedInstance]twitterAPI]postTokenRequest:^(NSURL*url,NSString*oauthToken){[[UIApplicationsharedApplication]openURL:url];}oauthCallback:@"tweepr:/

ios - 如何在运行时确定只读属性是否弱?

我有一个类声明了两个属性。@property(nonatomic,readonly,weak)idfirst;@property(nonatomic,weak)idsecond;我在运行时使用以下代码来检查属性的属性:unsignedintpropertyCount;objc_property_t*properties=class_copyPropertyList(class,&propertyCount);for(intpropertyIndex=0;propertyIndex不幸的是,我得到了这些结果:attributesofpropertyareT@,R,N,V_first.We

ios - writeToFile 在 iOS 7 上工作而不在 iOS 6 上工作

我遇到了一个问题,但找不到任何相关信息。我得到了一些代码,可以使用iOS在Documents文件夹中写入文件。检查了Apple文档,我想把它放在下一次发布时可用的地方。这是我使用的代码:-(void)writeToTextFile:(NSString*)logMessageinFile:(NSString*)fileName{//getthedocumentsdirectory:NSArray*paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES);NSString*docu

ios - 根据找到的字符换行

我想通过“@”将UILabel中的电子邮件分成两行,例如:abc123@gmail.com如果单词在NSString*variable中,我该如何打破它?我应该按字符搜索字符串直到找到“@”吗? 最佳答案 您应该在String上使用components(separatedByseparator:String)->[String]函数:swift:letstringComponentsArray=yourString.components(separatedBy:"@")objective-C:NSArray*stringCompon

ios - NSString 字符串与 CString :encoding: - not copying the Cstring?

我需要为我的对象计算签名(一种哈希)。计算需要许多每个字符的操作,因此为了加快此过程,我的代码对CString进行操作,然后将计算的CString转换为最终的NSString。stub代码如下所示:-(NSString*)signature{NSString*signatureString=@"?";char*buffer;buffer=malloc(sizeof(char)*(self.hashLength+1));if(buffer){//CodecomputingasignatureintothebuffersignatureString=[NSStringstringWithC

ios - 我将如何最好地使用 componentsSeparatedByCharacterSet 但将分隔符/分隔符附加到第一个单词?

假设我有以下句子:Iamasentencethathashyphenated-wordsatsome-pointsinit.我有以下代码:NSCharacterSet*separators=[NSCharacterSetcharacterSetWithCharactersInString:@"-"];NSArray*sentenceArray=[sentencecomponentsSeparatedByCharactersInSet:separators];将字符串分隔成一个数组,以空格和连字符分隔。结果数组是:["I","am","a","sentence","that","has"

ios - 在uipickerview中显示选中的值

我的详细页面有一个uipickerview。当我编辑来self的tableviewcell的相应记录时,我想获得默认选择的值。简而言之,我有一个包含10条记录的TableView。当我从tableview单元格中选择一条记录时,它会导航到详细页面,其中包含三个选择器View,每个View都有一个组件。我希望选择器View默认加载所选值。下面是我如何加载数据的代码。如何在-(NSString*)pickerView:(UIPickerView*)pickerViewtitleForRow:(NSInteger)row中显示所选值,还有一件事是我正在为此页面使用UINavigationco

ios - 具有大量数值的 PickerView

我见过这样使用选择器View的示例,其中选择器的值被硬编码到源代码中-(NSString*)pickerView:(UIPickerView*)pickerViewtitleForRow:(NSInteger)rowforComponent:(NSInteger)component{NSString*title=nil;switch(row){case0:title=@"a";break;case1:title=@"b";break;case2:title=@"c";break;}但是,如果您要在选择器View中有100个数字,那将是非常不切实际的。我相信您可以在下面看到我正在尝试做的

ios - 如何使用 cookie 在 instagram 中进行身份验证?

所以我有我的authinstagram代码。token已提供但不工作并显示消息“Youmusttoswitchcookies”。我必须做什么?谢谢回答。现在我尝试从instagram获取token:NSURL*url=[NSURLURLWithString:@"http://instagram.com"];NSMutableURLRequest*request=[[NSMutableURLRequestalloc]init];[requestsetURL:url];[requestsetHTTPMethod:@"GET"];[requestsetHTTPShouldHandleCook

ios - 通过http上传视频

所以这是我的尝试:我首先创建一个“图像选择器”,它允许我拍摄视频:-(IBAction)takeVideo:(UIButton*)sender{UIImagePickerController*picker=[[UIImagePickerControlleralloc]init];picker.delegate=self;picker.allowsEditing=YES;picker.sourceType=UIImagePickerControllerSourceTypeCamera;picker.mediaTypes=[[NSArrayalloc]initWithObjects:(NS