我从SQLite数据库中检索了大量数据.检索时,我将其映射到我的应用程序中的不同视图.我的表格中有一个文本字段,我不希望得到全文,只有前n个字符.所以如果我的查询例如是:
Select description from articles where id='29';
Run Code Online (Sandbox Code Playgroud)
那么如何从描述中获取子字符串?谢谢
我的Split-View应用程序中有UIPopoverController,我只需要更长时间的弹出窗口.在DetatilViewController的viewDidLoad中我放了:
self.popoverController.popoverContentSize=CGSizeMake(320, 1400);
Run Code Online (Sandbox Code Playgroud)
什么都没发生(什么时候应该放这个?谢谢
做完了^^^如何设置Popover的背景?thaanks
当我改变方向时,我的textview调整大小不正确,边界向右或向左或向下或向上跳跃......这是我的代码,请帮助我....我怎样才能调整我的全文文件UIView ..谢谢
- (void)viewDidLoad
{ frameHor=CGRectMake(0,10,275,306);
frameVer=CGRectMake(0, 51, 320, 351);
..
}
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration{
[super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration];
if(toInterfaceOrientation == UIInterfaceOrientationPortrait || toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
//self.view = portraitView;
[self changeTheViewToPortrait:YES andDuration:duration];
}
else if(toInterfaceOrientation == UIInterfaceOrientationLandscapeRight || toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft){
//self.view = landscapeView;
[self changeTheViewToPortrait:NO andDuration:duration];
}
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
- (void) changeTheViewToPortrait:(BOOL)portrait andDuration:(NSTimeInterval)duration {
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:duration];
if(portrait){
self.titleLabel.hidden=NO;
self.backButton.hidden=NO;
[self.view setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"det.png"]]];
self.fullText.frame=CGRectMake(frameVer.origin.x, frameVer.origin.y, frameVer.size.width, frameVer.size.height);
}
else{
self.titleLabel.hidden=YES;
self.backButton.hidden=YES;
self.fullText.frame=CGRectMake(frameHor.origin.x, frameHor.origin.y, frameHor.size.width, frameHor.size.height);
[self.view setBackgroundColor:[UIColor …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation
{
return [Braintree handleOpenURL:url sourceApplication:sourceApplication];
}
Run Code Online (Sandbox Code Playgroud)
但Facebook SDK集成要求我这样做:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication
annotation:(id)annotation {
// attempt to extract a token from the url
return [FBAppCall handleOpenURL:url sourceApplication:sourceApplication];
}
Run Code Online (Sandbox Code Playgroud)
如何处理必要的申请?
我有UItableview和两个按钮Next和Previous点击,我应该选择上一个/下一个单元格?可能吗?此外,如何记住用户最后点击的单元格,以便在启动时选择它?
我正在为欧洲市场制作应用程序的自定义日历视图.在一个函数中,我应该得到星期几的数字...我这样做,但它返回从星期日开始的星期几的数字.我应该怎么硬编码从星期一开始返回这个号码?谢谢这是我到目前为止:
-(int)getWeekDay:(NSDate*)date_
{
NSLocale *frLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"fr_FR"];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
[gregorian setLocale:frLocale];
NSDateComponents *comps = [gregorian components:NSWeekdayCalendarUnit fromDate:date_];
int weekday = [comps weekday];
NSLog(@"Week day is %i", weekday);
return weekday;
}
Run Code Online (Sandbox Code Playgroud) 我使用XAML代码在WPF中创建一个3D立方体,如下所示:
<Viewport3D Name="viewport3D1">
<Viewport3D.Camera>
<PerspectiveCamera x:Name="camMain" Position="6 5 4" LookDirection="-6 -5 -4">
</PerspectiveCamera>
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<DirectionalLight x:Name="dirLightMain" Direction="-1,-1,-1">
</DirectionalLight>
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D>
<ModelVisual3D.Content>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D x:Name="meshMain"
Positions="0 0 0 1 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1"
TriangleIndices="2 3 1 2 1 0 7 1 3 7 5 1 6 5 7 6 4 5 6 2 0 2 0 4 2 7 3 2 …Run Code Online (Sandbox Code Playgroud) UITableView,如何以编程方式更改整个tableview的宽度和高度?或者如何改变细胞的宽度?至于身高,我改变它
- (CGFloat)tableView:(UITableView *)_tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 100;
}
Run Code Online (Sandbox Code Playgroud)
这个技巧对宽度不起作用(((
顺便说一下,我有拆分视图应用程序.此外,如何用另一种颜色高亮选择细胞?不是用蓝色的
当我的应用程序启动它应该促使用户登录游戏中心,以便我可以检索他的昵称,然后用它来显示他的名字,我有以下代码,以某种方式工作一次:
- (void) authenticateLocalPlayer
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.isAuthenticated)
{
// Perform additional tasks for the authenticated player.
}
}];
}
Run Code Online (Sandbox Code Playgroud)
它显示了带有一些按钮的警报视图,但它不起作用.帮助,也许有一种更简单的方法来检索当前玩家的昵称.谢谢!!
我在C#.NET中进行了简单的自定义加密,加密成功通过,但解密出错了.该算法非常直观,但我不知道为什么它的解密错误.这是我的代码:
private void button1_Click(object sender, RoutedEventArgs e)
{
//Encrypting
byte[] initial_text_bytes = Encoding.UTF8.GetBytes(initial_text_tb.Text);
byte[] secret_word_bytes = Encoding.UTF8.GetBytes(secret_word_tb.Text);
byte[] encrypted_bytes = new byte[initial_text_bytes.Length];
int secret_word_index = 0;
for (int i=0; i < initial_text_bytes.Length; i++)
{
if (secret_word_index == secret_word_bytes.Length)
{
secret_word_index = 0;
}
encrypted_bytes[i] = (byte)(initial_text_bytes[i] + initial_text_bytes[secret_word_index]);
secret_word_index++;
}
// String s = Encoding.UTF8.GetString(encrypted_bytes);
//new String(Encoding.UTF8.GetChars(encrypted_bytes));
text_criptat_tb.Text = Convert.ToBase64String(encrypted_bytes);
}
private void button2_Click(object sender, RoutedEventArgs e)
{
//Decrypting
byte[] initial_text_bytes = Encoding.UTF8.GetBytes(text_criptat_tb.Text);
byte[] secret_word_bytes = Encoding.UTF8.GetBytes(secret_word_tb.Text);
byte[] encrypted_bytes = …Run Code Online (Sandbox Code Playgroud) 我在这里
int x=3;
NSLog(@"%i", x);
Run Code Online (Sandbox Code Playgroud)
如何让它显示为"01"?如果x = 12,它显示为"12"?谢谢
我正在构建一个iphone应用程序,我应该在其中根据一些数据创建一个新视图...那么我如何以编程方式创建一个带有按钮,标签和图片的新视图?有人举个例子吗?!
我必须下载数据库并替换沙箱中的现有数据库:这是可行的方法:
DBHelpers *help=[[DBHelpers alloc] init];
NSString *targetPath=[[help DocumentsDirectory] stringByAppendingPathComponent:DATABASE_NAME];
NSLog(@"Target path: %@", targetPath);
NSFileManager *fileManager=[NSFileManager defaultManager];
//if([fileManager fileExistsAtPath:targetPath])
//{
// NSLog(@"Exists");
// return;
}
NSString *sourcePath=[help PathForResource:DATABASE_NAME];
NSLog(@"SourcePath path: %@", sourcePath);
NSError *error;
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"www.hello.com/mydb.sqlite"]];
[data writeToFile:targetPath atomically:NO];
// [fileManager copyItemAtPath:sourcePath toPath:targetPath error:&error];
NSLog(@"Error %@", error);
Run Code Online (Sandbox Code Playgroud) objective-c ×8
iphone ×5
ios ×4
sqlite ×2
uitableview ×2
3d ×1
appdelegate ×1
c# ×1
database ×1
dayofweek ×1
encryption ×1
game-center ×1
nsdate ×1
nslog ×1
nsurl ×1
wpf ×1
xaml ×1