NSData* jsonDataToSendTheServer;
NSDictionary *setUser = [NSDictionary
dictionaryWithObjectsAndKeys:[@"u" stringByAppendingString:my.id],@"id",
@"GET_USER_INFO",@"command",
@"",@"value",
nil];
NSLog(@"%@", jsonDataToSendTheServer);
Run Code Online (Sandbox Code Playgroud)
这是我的代码.当我运行上面的代码时,我得到了这个打印
<7b226964 223a2275 35383738 37373334 31222c22 636f6d6d 616e6422 3a224745 545f5553 45525f49 4e464f22 2c227661 6c756522 3a22227d>
Run Code Online (Sandbox Code Playgroud)
我不知道我是否可以创建一个json.
我怎样才能解决这个问题?
我有几个嵌入在UINavigationController中的视图控制器(一些模态,一些模型),并使用滑动手势导航它们:
// Gesture recognizers
UISwipeGestureRecognizer *downGesture = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(dismissButton)];
downGesture.direction = UISwipeGestureRecognizerDirectionDown;
[downGesture setCancelsTouchesInView:NO];
[self.view addGestureRecognizer:downGesture];
Run Code Online (Sandbox Code Playgroud)
这样可以正常工作,但是我希望用户能够物理地拖动模态显示的视图控制器,例如,向下和离开屏幕,而不仅仅是轻弹和动画完成剩下的工作,或者在屏幕上拖动并捕捉到上一个视图而不是点击后退按钮.
我已尝试在视图上使用平移手势实现此功能,但当然前面的视图控制器在它后面是不可见的,它需要它.这种效果如何正确实现?用视图控制器控制?如果是这样,当将几个视图控制器推送到堆栈时,它会如何工作?我正在谈论的导航类型的一个例子可以在LetterPress应用程序中找到.
谢谢.
uiviewcontroller uinavigationcontroller uigesturerecognizer ios
我为我的应用程序制作了一个简单的照片幻灯片,问题是我的代码不再重复最后一张图像后的图像了!这是我的代码:
- (IBAction)start:(id)sender {
_button.hidden = YES;
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(photoCounter) userInfo:nil repeats:YES];
}
- (void)photoCounter {
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.90];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:NO];
[self updatePhoto];
imageCount ++;
[UIView commitAnimations];
}
- (void)updatePhoto {
switch (imageCount) {
case 0:
_images.image = [UIImage imageNamed:@"wall1.jpg"];
break;
case 1:
_images.image = [UIImage imageNamed:@"wall2.jpg"];
break;
case 2:
_images.image = [UIImage imageNamed:@"wall3.jpg"];
break;
case 3:
_images.image = [UIImage imageNamed:@"wall4.jpg"];
break;
case 4:
_images.image = [UIImage imageNamed:@"wall5.jpg"];
break;
default:
break;
}
}
Run Code Online (Sandbox Code Playgroud) 我是iOS的新手,我想为我的应用程序登录facebook.
我用facebook的新ios sdk尝试了很多.但我得到错误.
代码是
-(IBAction)logIn:(id)sender;
{
AppDelegate *appdelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appdelegate sessionOpener];
FBRequest *me = [FBRequest requestForMe];
[me startWithCompletionHandler: ^(FBRequestConnection *connection,
NSDictionary<FBGraphUser> *my,
NSError *error) {
NSLog(@"id %@", my.id);
NSLog(@"name %@", my.first_name);
greet.text = my.first_name;//this is a label to show the name
user.userID = my.id;//this is a FBProfilePictureView to show
}];
[UIView transitionFromView:self.view
toView:userPage
duration:0.5
options:(UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionTransitionFlipFromLeft)
completion:NULL]; }
`
and sessionOpener is;
-(void) sessionOpener{
[FBSession sessionOpenWithPermissions:nil
completionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// session …
Run Code Online (Sandbox Code Playgroud) 我有一个方法,不要使用ARC:
-(void)readAppPlist
{
NSString *plistPath = [self getDataFileDestinationPath];
NSData *plistXML = [[NSFileManager defaultManager] contentsAtPath:plistPath];
NSString *errorDesc = nil;
NSPropertyListFormat format;
NSMutableDictionary *temp = (NSMutableDictionary *) [NSPropertyListSerialization propertyListFromData:plistXML mutabilityOption:NSPropertyListMutableContainersAndLeaves format:&format errorDescription:&errorDesc];
if (!temp) {
NSLog(@"Error reading plist: %@, formatL %d", errorDesc, format);
}
items = [[temp objectForKey:@"Items"] mutableCopy];
}
Run Code Online (Sandbox Code Playgroud)
根据内存管理规则,我需要为变量plistPath,plistXML,errorDesc,temp释放内存?我应该另外一个方法,在这里发布它们或者只是将它们放入这个类的dealloc全局方法中吗?