我正在研究Android的自定义键盘,我遇到了一个问题,键盘似乎在右边留下一个白线/空格,而不是填充父视图...(不要介意图标,它现在只是占位符图形)
下面你可以看到我的布局......
<Keyboard xmlns:android="http://schemas.android.com/apk/res/android"
android:keyWidth="14%p"
android:horizontalGap="0px"
android:verticalGap="0px"
android:keyHeight="60dp"
>
<Row>
<Key android:codes="49" android:keyIcon="@drawable/rsz_emoji" android:horizontalGap="1%p" android:keyEdgeFlags="left"/>
<Key android:codes="50" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="51" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="52" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="53" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="54" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="48" android:keyIcon="@drawable/rsz_emoji" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="113" android:keyIcon="@drawable/rsz_emoji" android:horizontalGap="8%p" android:keyEdgeFlags="left"/>
<Key android:codes="114" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="116" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="121" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="111" android:keyIcon="@drawable/rsz_emoji"/>
<Key android:codes="112" android:keyIcon="@drawable/rsz_emoji" android:keyEdgeFlags="right"/>
</Row>
<Row>
<Key android:codes="1" android:keyIcon="@drawable/rsz_emoji" android:keyWidth="28%p" android:horizontalGap="8%p" android:keyEdgeFlags="left"/>
<Key android:codes="46" android:keyIcon="@drawable/rsz_emoji" android:keyWidth="28%p"/>
<Key android:codes="58" android:keyIcon="@drawable/rsz_emoji" android:keyWidth="28%p" android:keyEdgeFlags="right"/>
</Row>
<Row android:rowEdgeFlags="bottom">
<Key android:codes="44" android:keyIcon="@drawable/globe" …Run Code Online (Sandbox Code Playgroud) 我从照片库中获取用户的图像,我想将其传递给另一个视图...
我读过我应该能够做到这样的事情:
secView.imgView.image = selectedImage.image;
Run Code Online (Sandbox Code Playgroud)
在第二个视图上将我的UIImageView设置为来自我的UIImageView的图像...但是第二个视图中的UIImageView只是空的...
我的代码就是这个......
ViewController.h:
@interface ViewController : UIViewController <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
{
UIImagePickerController *picker;
IBOutlet UIImageView *selectedImage;
SecondView *secondView;
}
@property (nonatomic, retain) UIImageView *selectedImage;
@property (nonatomic, retain) SecondView *secondView;
-(IBAction)sendImage:(id)sender;
-(IBAction)openGallery:(id)sender;
@end
Run Code Online (Sandbox Code Playgroud)
ViewController.m(仅相关部分)
-(IBAction)sendImage:(id)sender
{
if(self.secondView == nil)
{
SecondView *secView = [[SecondView alloc] initWithNibName:@"SecondView" bundle:[NSBundle mainBundle]];
self.secondView = secView;
secView.imgView.image = selectedImage.image;
}
[self.navigationController pushViewController:secondView animated:YES];
}
-(IBAction)openGallery:(id)sender
{
picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
}
-(void)imagePickerControllerDidCancel:(UIImagePickerController …Run Code Online (Sandbox Code Playgroud) 我正在编写一个主要使用从Web服务获取的数据的应用程序,我想使用AsyncTask在后台运行SOAP调用...我对Android很新(作为iOS程序员),所以我'这个有点新......
现在,我有一个登录屏幕,在那里我使用用户提供的登录信息并根据服务器上的信息进行检查...
所以在我的登录活动中:
loginBtn.setOnClickListener(new OnClickListener()
{
public void onClick(View v)
{
//Run the connection to authenticate the user
AuthenticateConnection mAuth = new AuthenticateConnection();
mAuth.mNumber = number;
mAuth.mPassword = pass;
mAuth.connection();
}
}
Run Code Online (Sandbox Code Playgroud)
我的肥皂课是这样的:
public class AuthenticateConnection
{
private static final String SOAP_ACTION = "http://tempuri.org/Authenticate";
private static final String METHOD_NAME = "Authenticate";
private static final String NAMESPACE = "http://tempuri.org/";
private String URL;
public Boolean userOK;
public String mNumber;
public String mPassword;
public AuthenticateConnection()
{
}
public void connection()
{
Singleton service …Run Code Online (Sandbox Code Playgroud) 可能重复:
发送到实例的无法识别的选择器
嗯......像其他许多人一样,我得到了一个"无法识别的选择器发送到实例"错误......
当我按下按钮时会出现问题,例如在这种情况下:
-(IBAction)gotoTone:(id)sender
{
if(self.tone == nil)
{
Tone *toneMain = [[Tone alloc]
initWithNibName:@"Tone" bundle:[NSBundle mainBundle]];
self.tone = toneMain;
[toneMain release];
}
[self.navigationController pushViewController:tone animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
错误是:由于未捕获的异常'NSInvalidArgumentException'终止应用程序,原因:' - [Tone gotoTone:]:无法识别的选择器发送到实例0x531caa0'
在我将新视图作为第一个视图呈现给用户之后插入错误...此外,我使用导航栏,首先我忘记进入MainWindow.xib并将导航控制器更改为新视图,但现在已经解决了.
你可以看到我的整个代码:
其中文件发生.H:http://snipt.org/xnoO 其中文件发生的.m:http://snipt.org/xnoM
不要介意所有的评论线,直到我得到这个固定...
我已经尝试通过阅读"无法识别的选择器发送到实例"的其他情况找到解决方案,但我想我只是没有看到解决方案.我已经检查了我的IB连接,我已经清理了这个项目......
任何帮助将不胜感激
我正在使用带有节和多个选择的tableview,但是当选择一行时我有一个问题,即检查多行...我已经看到了一些其他线程,但是没有真正得到解决方案. ..
这是我的代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *) indexPath
{
[employeeTable deselectRowAtIndexPath:[employeeTable indexPathForSelectedRow] animated:NO];
UITableViewCell *cell = [employeeTable cellForRowAtIndexPath:indexPath];
// get the letter in each section
NSString *alphabet = [charIndex objectAtIndex:indexPath.section];
// get the names beginning with the letter
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF beginswith[c] %@", alphabet];
NSArray *names = [listOfNames filteredArrayUsingPredicate:predicate];
NSString *name = [names objectAtIndex:indexPath.row];
for(int i = 0; i < [employeeConnection.employees count]; i++)
{
Employee *aEmployee = [employeeConnection.employees objectAtIndex:i];
NSString *firstName = aEmployee.firstName;
NSString *lastName = aEmployee.lastName;
NSString …Run Code Online (Sandbox Code Playgroud) 我用AFNetworking下载它后找到我的文件有一些问题...下载本身很好,但是当我检查文件的存在后,我找不到它...所以我希望有人可以帮我...
在我的代码中,我下载了文件,在完成块中,我检查是否存在(这只是因为我遇到了问题,之后会被删除)...
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"url to file removed"]];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"filename removed"];
operation.outputStream = [NSOutputStream outputStreamToFileAtPath:@"filename removed" append:NO];
//Track the progress
[operation setDownloadProgressBlock:^(NSUInteger bytesRead, long long totalBytesRead, long long totalBytesExpectedToRead)
{
if (totalBytesExpectedToRead > 0)
{
dispatch_async(dispatch_get_main_queue(), ^{
NSString *progress = [NSString stringWithFormat:@"Downloaded %lld of %lld bytes",
totalBytesRead,
totalBytesExpectedToRead];
NSLog(@"%@", progress);
});
}
}];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)
{
NSLog(@"File downloaded …Run Code Online (Sandbox Code Playgroud) 好的,所以我的问题是我在点击按钮时删除了tableview中的行,并且我通过获取发件人的标记并从我的数据源数组中删除它并从中删除该行来识别要删除的行.表...
在cellForRowAtIndexPath中(相关部分是deleteBtn):*以下是固定和工作代码
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"questionCell";
HTQuestionCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if(cell == nil)
{
cell = [[HTQuestionCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSDictionary *dict = [NSDictionary dictionary];
dict = _questionsArray[indexPath.row];
NSMutableAttributedString *atbString;
NSMutableAttributedString *atbQuestionString;
atbString = [[NSMutableAttributedString alloc] initWithString:[dict objectForKey:@"person"] attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:34]}];
atbQuestionString = [[NSMutableAttributedString alloc] initWithString:[dict objectForKey:@"question"] attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:34]}];
[atbString appendAttributedString:atbQuestionString];
[cell.questionTxtView setAttributedText:atbString];
[cell.deleteBtn setTag:indexPath.row];
[cell.showBtn setTag:indexPath.row];
NSLog(@"Delete Button : %@", cell.deleteBtn);
[cell.deleteBtn addTarget:self action:@selector(deleteMsg:) forControlEvents:UIControlEventTouchUpInside];
[cell.showBtn addTarget:self action:@selector(showMsg:) …Run Code Online (Sandbox Code Playgroud) ios ×4
android ×2
uitableview ×2
afnetworking ×1
ime ×1
keyboard ×1
ksoap2 ×1
uiimage ×1
uiimageview ×1
xml ×1