我的iPhone应用程序现已进入测试阶段.我正在使用TestFlight将应用程序发送给测试人员.一切都很好,我发布链接,他们下载应用程序,没有任何证书或任何问题(真实的故事,哈哈).
我唯一的问题是我完全不知道如何发送应用程序内更新.我在最新的SDK版本上看到它可用,但我无法弄清楚如何做到这一点!现在,如果我上传新版本,并选择"更新并通知",则会发送一封电子邮件.如何直接通过我的应用向用户发送新版本可用的通知?现在我开始认为这是不可能的(如果是这样,我的坏).但我真的以为我能做到!
一如既往,任何帮助/链接/文档总是受到赞赏!:)
当我创建了一个UILabel与textAlignement设置为NSTextAlignmentCenter,lineBreakMode到NSLineBreakByWordWrapping和长文本,它分裂是这样的:
+------------------------------------+
| Text that does not fit on a single |
| line |
+------------------------------------+
Run Code Online (Sandbox Code Playgroud)
但是我真正想要的是这样的东西:
+------------------------------------+
| Text that does not fit |
| on a single line |
+------------------------------------+
Run Code Online (Sandbox Code Playgroud)
当然,我不想手动处理换行符。我希望标签自动平衡线条,使它们的长度尽可能接近。
我正在编写一个iOS应用程序,我必须使用微调器显示UIAlertView.有时,当我尝试在警报的中心添加微调器时出现问题,通常是在此之前有另一个警报(不完全是规则,但这是我注意到失败的方式).
我通过推迟创建微调器来部分解决了这个问题.我是这样做的(警报是成员UIAlertView):
此代码位于viewDidLoad中:
alert = [[[UIAlertView alloc] initWithTitle:@"Loading..." message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles: nil] autorelease];
[alert show];
[self performSelector:@selector(addSpinner) withObject:nil afterDelay:0.5f];
Run Code Online (Sandbox Code Playgroud)
这个是我的addSpinner函数:
- (void) addSpinner{
UIActivityIndicatorView *indicator2 = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
indicator2.center = CGPointMake(alert.bounds.size.width / 2, alert.bounds.size.height - 50);
[indicator2 startAnimating];
[alert addSubview:indicator2];
[indicator2 release];
}
Run Code Online (Sandbox Code Playgroud)
这个解决方案每次都在运行,但我真的不喜欢它是如何完成的.即使在警报弹出后半秒钟显示旋转器并不是那么令人不安,但必须有更好的方法来处理它.我不是iOS专家,也不是高级程序员,但我不能使用活动?像"实际显示警报时,转到addSpinner功能"这样的东西?我不知道怎么做,在网上找不到多少帮助......
希望可以有人帮帮我 !谢谢.
我正在开发一个iPhone应用程序,我想合并两个UIImages(leftImage和rightImage).任何人都可以建议如何做到这一点,而他们之间没有线条?
我目前正在这样做:
- (UIImage*)mergeImage:(UIImage*)first withImage:(UIImage*)second
{
// get size of the first image
CGImageRef firstImageRef = first.CGImage;
CGFloat firstWidth = CGImageGetWidth(firstImageRef);
CGFloat firstHeight = CGImageGetHeight(firstImageRef);
// get size of the second image
CGImageRef secondImageRef = second.CGImage;
CGFloat secondWidth = CGImageGetWidth(secondImageRef);
CGFloat secondHeight = CGImageGetHeight(secondImageRef);
// build merged size
CGSize mergedSize = CGSizeMake((firstWidth+secondWidth), MAX(firstHeight, secondHeight));
// capture image context ref
UIGraphicsBeginImageContext(mergedSize);
//Draw images onto the context
[first drawInRect:CGRectMake(0, 0, firstWidth, firstHeight)];
//[second drawInRect:CGRectMake(firstWidth, 0, secondWidth, secondHeight)];
[second drawInRect:CGRectMake(firstWidth, 0, secondWidth, secondHeight) …Run Code Online (Sandbox Code Playgroud) 我想比较两个日期并检查日期是否已过期.
这是我使用的代码:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:ss:ii");
Date date1 = sdf.parse("20012-10-4 10:15:25");
Date date2 = sdf.parse("2013-10-4 10:15:25");
if(date1.equals(date12)){
System.out.println("Both are equals");
}
Run Code Online (Sandbox Code Playgroud)
我想查看两个日期,但没有成功.
我也尝试过这样检查:
if(date1 >= date2){
System.out.println("Both are not equals");
}
Run Code Online (Sandbox Code Playgroud)
但它也没有用.
我正在尝试做一些非常简单的事情:btn-group在它旁边放一些文本和一组按钮(使用类):
Make your choice : BUTTON
Run Code Online (Sandbox Code Playgroud)
这是我使用的代码:
<div>
<p>Make your choice :</p>
<div class="btn-group">
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown">
Button <span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<li><a href="#" id="btn1">Select 1</a></li>
<li><a href="#" id="btn2">Select 2</a></li>
<li><a href="#" id="btn3">Select 3</a></li>
</ul>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
此代码产生如下内容:
Make your choice :
BUTTON
Run Code Online (Sandbox Code Playgroud)
我正在寻找一个Bootstrap解决方案,让文本和按钮在同一行.我不想创建自己的样式,我想使用现有的Bootstrap类/组件来实现这一点.
我在Xcode 5的iOS 7项目中遇到autolayout困难.假设我想显示这些按钮:
Something
-
| 10 pts fixed space from top
-
Button 1 50 pts height on 4" display, reduce height if 3"5
-
| 10 pts fixed space
-
Button 2 50 pts height on 4" display, reduce height if 3"5
Run Code Online (Sandbox Code Playgroud)
我在Interface Builder中布置我的按钮(带有故事板).
然后我开始添加约束:
问题是Autolayout抱怨我的按钮,说"预期:身高= 30".为什么?我想要一个50分的按钮,为什么这是一个问题?当然,我可以通过添加高度约束来解决这个问题,但是如果屏幕高度降低,我希望降低高度.并且,如果我运行它,即使在4"显示器上,按钮的高度设置为30,因为autolayout说它"应该"..而我甚至没有设置第二个按钮的约束,这将使它均匀更差.
我怎么能做到这样的事情?它似乎非常基本,我仍然不明白发生了什么.
请注意,我可以手动设置代码中的所有高度,但我真的想避免这种情况.
我最近创建了一个java程序,它可以打印收据并打开连接到打印机的现金抽屉。
现在我需要打开现金抽屉,该现金抽屉将通过RJ11直接连接到计算机。
因为我不会将钱箱连接到打印机,所以我的feedPrinter意志毫无用处。那么我如何调用现金抽屉并向其发送命令呢?
这是我的代码
public String openDrawer()
{
final byte[] openCD={27,112,0,60,120};
String s=new String(openCD);
commandSet+=s;
return s;
}
public static void main(String args[])
{
PrinterOptions p=new PrinterOptions();
p.openDrawer();
feedPrinter(p.finalCommandSet().getBytes());
}
private static boolean feedPrinter(byte[] b)
{
try
{
AttributeSet attrSet = new HashPrintServiceAttributeSet(new PrinterName("PRINTERNAME", null));
//what should I change PRINTERNAME to connect directly to cash drawer
DocPrintJob job = PrintServiceLookup.lookupPrintServices(null, attrSet)[0].createPrintJob();
DocFlavor flavor = DocFlavor.BYTE_ARRAY.AUTOSENSE;
Doc doc = new SimpleDoc(b, flavor, null);
PrintJobWatcher pjDone = new PrintJobWatcher(job);
job.print(doc, …Run Code Online (Sandbox Code Playgroud) 一个非常简单的问题,但我似乎无法找到答案.(开发iOS 5+应用程序).
在我的AppDelegate中,我有一个属性,让我们称之为@property (non atomic) BOOL aFlag;.如果值发生变化,我希望我的AppDelegate得到通知.这是我尝试的(一切都发生在AppDelegate.m),这与我用观察者"链接"两个不同的对象时相同:
-(BOOL)application:(UIApplication*)application
didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {
// Some stuff
_aFlag = YES;
[self addObserver:self
forKeyPath:@"aFlag"
options:(NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld)
context:nil];
// Some other stuff
}
-(void)observeValueForKeyPath:(NSString*)keyPath
ofObject:(id)object
change:(NSDictionary*)change
context:(void*)context {
if ([keyPath isEqual:@"aFlag"]) {
// Do something
} else {
// Do nothing
}
}
Run Code Online (Sandbox Code Playgroud)
但是observeValueForKeyPath:不叫.
我哪里错了?谢谢.
您好,我在我的应用中使用Dropbox API.我想从我的Dropbox帐户下载图像并将它们存储在模拟器或设备目录中.我使用Full DropBox Access在Dropbox中创建了应用程序.但它给了我这个错误:
[警告] DropboxSDK:向/ 1/files/sandbox/Photos发出错误请求 - App文件夹(沙盒)访问尝试失败,因为此应用程序未配置为具有应用程序文件夹.您的访问类型应该是"dropbox"吗?
这是我的代码
restClient = [[DBRestClient alloc] initWithSession:[DBSession sharedSession]];
restClient.delegate = self;
NSString *fileName = [NSString stringWithFormat:@"/avatar.jpg"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString* path2 = [documentsDirectory stringByAppendingString:
[NSString stringWithFormat:@"%@", fileName]];
[restClient loadFile:fileName intoPath:path2];
Run Code Online (Sandbox Code Playgroud) ios ×7
objective-c ×5
iphone ×2
java ×2
addobserver ×1
autolayout ×1
css ×1
date ×1
html ×1
in-app ×1
line-breaks ×1
merge ×1
self ×1
testflight ×1
uialertview ×1
uiimage ×1
uilabel ×1
updates ×1
xcode ×1
xcode5 ×1