我是iPhone的新手,我想在特殊字符后剪切一个字符串,让我们把这个例子"works.php",我想从这个字符串中删除".php",这意味着我要删除"."之后的内容.这样做的代码是什么?提前致谢.
我想从数据库中检索笔记(非空),我编写了以下代码:
public Cursor getmynotesss(int id){
Cursor mCursor = database.query(true, NOTES_TABLE, new String[] {
NOTE_TEXT, PAGE_NO,BOOK_ID},BOOK_ID + "=? AND "+NOTE_TEXT+" IS NOT NULL OR "+NOTE_TEXT+" != ''" ,
new String[] { String.valueOf(id) }, null, null, null, null);
if (mCursor != null) {
mCursor.moveToFirst();
}
return mCursor;
}
Run Code Online (Sandbox Code Playgroud)
但它仍然给我空的笔记.我的代码有什么问题?
我正在创建Android应用程序来播放liveStream,我在layout.xml中添加了videoView并添加了layout-land的文件夹
我想让应用程序显示视频全屏只在布局 - 土地而不是肖像
所以我在onCreate()中添加了以下代码:
public void onConfigurationChanged(Configuration newConfig){
if(getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE
{
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
Run Code Online (Sandbox Code Playgroud)
但我的问题是,当我旋转设备时,它重新开始活动,这导致视频流停止,我想阻止这一点.所以.我补充说明了这一行
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
Run Code Online (Sandbox Code Playgroud)
但是这导致onCreate()的代码只执行一次.
如何使我的应用程序连续播放视频流,当我旋转设备在布局土地上全屏,然后回到肖像使其正常?
希望有人得到我的意思.提前致谢.
我正在尝试在CGPDFDocument中加载拇指图像我在类"ReaderThumbFetch"中的一个名为"main"的函数中编写了以下代码
NSURL *thumbURL = [self thumbFileURL];
CGImageRef imageRef = NULL;
CGImageSourceRef loadRef = CGImageSourceCreateWithURL((CFURLRef)thumbURL, NULL);
if (loadRef != NULL) // Load the existing thumb image
{
imageRef = CGImageSourceCreateImageAtIndex(loadRef, 0, NULL); // Load it
CFRelease(loadRef); // Release CGImageSource reference
}
Run Code Online (Sandbox Code Playgroud)
并且"thumbFileURL"功能的实现是:
- (NSURL *)thumbFileURL
{
#ifdef DEBUGX
NSLog(@"%s", __FUNCTION__);
#endif
NSString *cachePath = [ReaderThumbCache thumbCachePathForGUID:request.guid]; // Thumb cache path
NSString *fileName = [NSString stringWithFormat:@"%@.png", request.thumbName]; // Thumb file name
return [NSURL fileURLWithPath:[cachePath stringByAppendingPathComponent:fileName]]; // File URL
}
Run Code Online (Sandbox Code Playgroud)
但是当我跑它时,它给了我:
Undefined symbols …
Run Code Online (Sandbox Code Playgroud) 我正在使用以下代码使用md5加密字符串
const char* str = [@"123456" UTF8String];
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(str, strlen(str), result);
NSMutableString *ret = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH*2];
for(int i = 0; i<CC_MD5_DIGEST_LENGTH; i++) {
[ret appendFormat:@"%02x",result[i]];
}
NSLog(@"%@", ret);
Run Code Online (Sandbox Code Playgroud)
现在我想要一个源代码来解密编码的字符串,Any Help?
我正在使用iPhone6模拟器,我正在尝试使用以下任何代码获取文件(任何扩展名为pdf的html):
NSString *file = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@.pdf", documentName] ofType:nil];
Run Code Online (Sandbox Code Playgroud)
要么
NSString *file2 = [[NSBundle mainBundle] pathForResource:documentName ofType:@"pdf"];
Run Code Online (Sandbox Code Playgroud)
我确定该文件存在于Resources文件夹中并且我没有添加该文件,我以编程方式从Web下载并在此路径中查看(/ Users/myMac/Library/Application Support/iPhone Simulator/6.9/Applications /E60F22DD-7301-48EF-AB25-B9D42FA6AD49/myApp.app)我看到了文件,但是代码看不到它
但是这个代码有时会让我为null,而有些时候会给我这个文件.
为什么会发生这种情况以及如何防止这种情况并使其始终为我提供文件.考虑我使用
if(file != nil)
Run Code Online (Sandbox Code Playgroud)
并希望如果file == nil尝试使用任何方式打开它.
提前致谢.