小编Saa*_*hry的帖子

UITextView不会更新其contentSize

我正在动态调整UITextView高度,并在UITableViewCell内容发生变化时嵌入高度.但我也能够粘贴预定义的文本位.

由于这种粘贴以编程方式发生,问题是,在将所选文本位添加到UITextView文本并调用我UITableView更新其单元格高度后,UITextView尚未更新其contentSize,我用它来计算单元格的高度.

在我以编程方式向其添加文本后,有没有办法强制UITextView更新其contentSize

objective-c uitableview uitextview ios contentsize

12
推荐指数
1
解决办法
7016
查看次数

刷新/重新加载/重新实例化android选项卡系统中的片段

我有一个带有viewpager的活动,它有3个标签和3个片段,每个标签内都有一个片段.我知道片段管理器存储了片段的初始实例,因此如果我从选项卡上滑动然后返回到该选项卡,它将被加载到内存中,并且不会对其应用任何更新.

我需要发生相反的情况,即:每次我滑动到选项卡时,需要加载该选项卡中的片段的新实例,以便更新数据.

我试过了:

  1. 在onTabSelected中分离附加片段(没有任何反应)
  2. 删除onTabSelected中的添加片段(没有任何反应)
  3. setOffscreenPageLimit(0)(没有任何反应)
  4. 刷新每个片段内的函数,调用onTabSelected(给出nullPointerException)

我一直在努力解决这个问题一个星期没有进展.我感谢任何帮助,无论是暗示,评论,建议.

让我知道我应该发布什么代码,谢谢.

tabs android android-fragments android-viewpager

12
推荐指数
2
解决办法
2万
查看次数

右侧的按钮没有出现在iphone 6和6+中

我正在尝试在我的tabbar中添加一个右键按钮navigationbar,它在iphone 5和5s设备以及所有模拟器中都能正常工作.但它没有出现在iphone 6和6+设备中.但它在iphone 6和6+的模拟器上工作正常.

这是按钮代码.

@property (nonatomic, weak) UIButton *rightButton;



-(void)setNavigationBarRightButton
{


    rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    rightButton.frame = CGRectMake(0, 0, 40, 40);
    rightButton.layer.cornerRadius = 20;
    rightButton.layer.borderColor = [[UIColor lightGrayColor] CGColor];
    rightButton.layer.borderWidth = 2;
    rightButton.imageView.layer.cornerRadius = 20;
    rightButton.clipsToBounds = YES;




    UIImage* image;

    NSData* imageData = [[NSUserDefaults standardUserDefaults] objectForKey:@"image"];


    if (imageData == (id)[NSNull null] || imageData.length == 0) {
        NSLog(@"image data is %@",imageData);
        image = [UIImage imageNamed:@"defaultIcon.png"];
    }
    else {
        image = [UIImage imageWithData:imageData];

    }

    // rightButton.imageView.image = image;
    [rightButton …
Run Code Online (Sandbox Code Playgroud)

objective-c uitabview rightbarbuttonitem navigationbar ios

7
推荐指数
1
解决办法
943
查看次数

如何将.sqlite3/.sqlite文件导入ios应用程序?

我有一个excel文件.

我已将该文件转换为.csv格式并将该文件导入base并将其转换为.sqlite文件.

所以问题是:

有没有办法将其导入ios应用程序并操纵数据.

有没有办法像核心数据一样使用它或将该文件导入核心数据.

请参考任何好的教程,最好是视频教程或其他一些好的教程.

sqlite iphone objective-c ios

6
推荐指数
1
解决办法
5671
查看次数

如何更改在目标c中使用贝塞尔曲线路径移动的对象的矩形

我想用bezier路径移动更改rect:

CAShapeLayer *shapeLayer = [CAShapeLayer layer];
shapeLayer.path = [self createArcPath].CGPath;
shapeLayer.strokeColor = [[UIColor blueColor] CGColor];
shapeLayer.lineWidth = 1.0;
shapeLayer.fillColor = [[UIColor clearColor] CGColor];
[self.view.layer addSublayer:shapeLayer];

UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];

// btn.frame = CGRectMake(326, 174, 64, 64);
[btn setBackgroundImage:[UIImage imageNamed:@"Volleyball_Ball.png" forState:UIControlStateNormal];
[self.view addSubview:btn];

// car = [CALayer layer];
// car.frame = CGRectMake(326, 174, 48, 48);
// car.contents = (id)([UIImage imageNamed:@"1453303583_circle_blue.png"].CGImage);
// [self.view.layer addSublayer:car];

CAKeyframeAnimation *anim = [CAKeyframeAnimation animationWithKeyPath:@"position"];
anim.path = [self createArcPath].CGPath;
anim.rotationMode = kCAAnimationRotateAuto;
anim.delegate = self;
anim.repeatCount = …
Run Code Online (Sandbox Code Playgroud)

cocoa-touch ios

6
推荐指数
0
解决办法
137
查看次数

试图调试'[UIActionSheet showInView:]'中的'断言失败'错误

我正在完成"开始iPad应用程序开发",并且在第3章中我已经创建了一个与Action Sheet一起工作的项目.

就像现在一样,我的应用程序很好地加载到模拟器中没有我知道的错误,但是当它运行时,它会在调试器窗口中显示以下错误而崩溃:

2010-05-31 19:44:39.703 UsingViewsActionSheet [49538:207]***断言失败 - [UIActionSheet showInView:],/ SourceCache/UIKit_Sim/UIKit-1145.66/UIAlert.m:7073

2010-05-31 19:44:39.705 UsingViewsActionSheet [49538:207]***由于未捕获的异常'NSInternalInconsistencyException'而终止应用程序,原因:'无效的参数不满足:view!= nil

"

我确信这是应用程序基于我使用断点而中断的块.

//实现viewDidLoad在加载视图后执行其他设置,通常是从nib.

- (void)viewDidLoad { UIActionSheet *action = [[UIActionSheet alloc] initWithTitle:@"This is my Action Sheet!" delegate:self cancelButtonTitle:@"OK" destructiveButtonTitle:@"Delete Message!" otherButtonTitles:@"Option 1", @"Option 2", @"Option 3", nil];

[action showInView:self.view];  // <-- This line seems to trigger the crash....
[action release];
[super viewDidLoad];
Run Code Online (Sandbox Code Playgroud)

}

我错过了一些明显的东西,还是问题比​​这里显示的更多?我已经查看了showInView的摘要,并且还无法对其进行任何修改.

我感谢任何和所有的支持.

问候,

史蒂夫奥沙利文

objective-c uiactionsheet ipad

3
推荐指数
1
解决办法
5743
查看次数