我的代码按预期工作只是因为我需要摆脱这个警告消息.在IOS6中不推荐使用TWTeetComposeViewController.是否在ios6中替换了这个内置视图控制器?
这是我的示例代码.
if ([TWTweetComposeViewController canSendTweet]) {
// Initialize Tweet Compose View Controller
TWTweetComposeViewController *vc = [[TWTweetComposeViewController alloc] init];
// Settin The Initial Text
[vc setInitialText:@"This tweet was sent using the new Twitter framework available in iOS 5."];
// Adding an Image
UIImage *image = [UIImage imageNamed:@"sample.jpg"];
[vc addImage:image];
// Adding a URL
NSURL *url = [NSURL URLWithString:@"http://mobile.tutsplus.com"];
[vc addURL:url];
// Setting a Completing Handler
[vc setCompletionHandler:^(TWTweetComposeViewControllerResult result) {
[self dismissModalViewControllerAnimated:YES];
}];
// Display Tweet Compose View Controller Modally
[self presentViewController:vc …
Run Code Online (Sandbox Code Playgroud) 我有一个UIView->UICollectionView->UICollectionViewCell
.我试图以编程方式返回,但这些都不起作用.代码确实调用了.我正在使用StoryBoard.
- (void) goBack:(NSNotification *) notification {
// [self.navigationController popViewControllerAnimated:YES];
// [self dismissViewControllerAnimated:YES completion:nil];
[self.navigationController popToRootViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud) 我正尝试在本地调试NetBeans Mac.
这是我的php.ini
[xdebug]
xdebug.default_enable=1
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.remote_log="/Applications/MAMP/logs/xdebug.log"
xdebug.idekey="netbeans-xdebug"
zend_extension="/Applications/MAMP/bin/php/php5.4.10/lib/php/extensions/no-debug-non-zts-20100525/xdebug.so"
Run Code Online (Sandbox Code Playgroud)
这是我在xdebug.log中获得的
I: Connecting to configured address/port: localhost:9000.
E: Could not connect to client. :-(
Run Code Online (Sandbox Code Playgroud)
我尝试将端口更改为9001并关闭防火墙,但它没有帮助.
我有一个800KB的JPG文件.我尝试上传到S3并继续获得超时错误.你能想出什么是错的吗?800KB对于上传而言相当小.
错误消息:未在超时期限内读取或写入与服务器的套接字连接.空闲连接将被关闭.
HTTP状态代码:400
AWS错误代码:RequestTimeout
Long contentLength = null;
System.out.println("Uploading a new object to S3 from a file\n");
try {
byte[] contentBytes = IOUtils.toByteArray(is);
contentLength = Long.valueOf(contentBytes.length);
} catch (IOException e) {
System.err.printf("Failed while reading bytes from %s", e.getMessage());
}
ObjectMetadata metadata = new ObjectMetadata();
metadata.setContentLength(contentLength);
s3.putObject(new PutObjectRequest(bucketName, key, is, metadata));
Run Code Online (Sandbox Code Playgroud) 我有多个文本字段,当我专注于文本框时,它将自动向上滚动,键盘将隐藏文本框。
知道如何在单击时将文本字段滚动到焦点字段吗?
- (void)registerForKeyboardNotifications
{
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWasShown:)
name:UIKeyboardDidShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillBeHidden:)
name:UIKeyboardWillHideNotification object:nil];
}
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
activeField = textField;
}
- (void)textFieldDidEndEditing:(UITextField *)textField
{
activeField = nil;
}
// Called when the UIKeyboardWillHideNotification is sent
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
UIEdgeInsets contentInsets = UIEdgeInsetsZero;
scrollView.contentInset = contentInsets;
scrollView.scrollIndicatorInsets = contentInsets;
}
- (void)keyboardWasShown:(NSNotification*)aNotification
{
NSDictionary* info = [aNotification userInfo];
CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
UIEdgeInsets contentInsets = UIEdgeInsetsMake(0.0, 0.0, kbSize.height, 0.0);
scrollView.contentInset = contentInsets;
scrollView.scrollIndicatorInsets …
Run Code Online (Sandbox Code Playgroud) 可能重复:
如何将浮点值舍入到小数点后2位?
假设我的双数为3.46.如何将其舍入到3.50?我试过了
NSLog(@"res: %.f", round(3.46));
Run Code Online (Sandbox Code Playgroud)
但它返回3.
我试图在代码的开头用uitextview显示垂直滚动条,但它没有这样做.
UITextView *txtView=[[UITextView alloc]initWithFrame:CGRectMake(10, 80,self.view.frame.size.width-20,self.view.frame.size.height/2)];
[txtView setEditable:NO];
[txtView setSelectable:NO];
[txtView setText:self.secret];
[txtView setBackgroundColor:[UIColor clearColor]];
[txtView setTextColor:[UIColor whiteColor ]];
[txtView setFont:font];
txtView.showsVerticalScrollIndicator=YES;
[txtView flashScrollIndicators];
[self.view addSubview:txtView];
Run Code Online (Sandbox Code Playgroud) ios ×5
objective-c ×5
amazon-s3 ×1
cocoa-touch ×1
ios6 ×1
iphone ×1
java ×1
keyboard ×1
netbeans ×1
php ×1
rounding ×1
twitter ×1
uitextfield ×1
uitextview ×1
xdebug ×1