我需要一个带有取消按钮的完全透明的搜索栏.我尝试了很多解决方案但是我找不到更好的解决方案.当我尝试删除背景颜色时,它会显示范围栏.任何人都可以给我一些带有can按钮的完全透明的搜索栏的源代码.这里的
addSearchbar.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:0.5];
UITextField *sbTextField = (UITextField *)[self.addSearchbar.subviews lastObject];
for (UIView *subview in addSearchbar.subviews)
{
NSLog(@"%@",subview);
if ([subview isKindOfClass:[UITextField class]])
{
sbTextField = (UITextField *)subview;
UIImage *image = [UIImage imageNamed: @"06_magnifying_glass.png"];
UIImageView *iView = [[UIImageView alloc] initWithImage:image];
iView.frame = CGRectMake(0, 0, 24, 24);
sbTextField.leftView.frame = CGRectMake(0, 0, 24, 24);
sbTextField.leftView = iView;
[sbTextField.rightView removeFromSuperview];
CGFloat myWidth = 24.0f;
CGFloat myHeight = 24.0f;
UIButton *myButton = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, myWidth, myHeight)];
[myButton setImage:[UIImage imageNamed:@"clear.png"] forState:UIControlStateNormal]; …Run Code Online (Sandbox Code Playgroud) 我遇到了一个奇怪的问题,我希望这是苹果的错误。让我知道这是否是 Apple 的错误。
脚步
现在下面的代码返回
for (CNLabeledValue *labelObj in contact.phoneNumbers) {
phone = [labelObj.value stringValue];
CNLabeledValue *cnPhoneLabel = [CNLabeledValue labeledValueWithLabel:labelObj.label value:labelObj.value];
NSString *phoneLabelString = [[CNLabeledValue localizedStringForLabel:cnPhoneLabel.label] capitalizedString];
}
Run Code Online (Sandbox Code Playgroud)
1号
"<CNLabeledValue: 0x148306800:
identifier=08C1A708-F5A2-4A65-AB08-024B3FCF79C4, label=(null),
value=<CNPhoneNumber: 0x148297aa0: countryCode=in, digits=2586352952356>>"
Run Code Online (Sandbox Code Playgroud)
2号
"<CNLabeledValue: 0x148296a60:
identifier=7D9ABC9E-D5AF-421D-BFF6-7902BC99E80F, label=_$!<Mobile>!$_,
value=<CNPhoneNumber: 0x148296aa0: countryCode=in, digits=7392>>"
Run Code Online (Sandbox Code Playgroud)
number1 标签返回标签为 null
NLabeledValue:0x148306800:标识符= 08C1A708-F5A2-4A65-AB08-024B3FCF79C4,标签=(空)
我已成功将图像转换为灰度,我想将灰度图像还原为RGB图像.请帮忙.提前致谢.
-(UIImage *) toGrayscale
{
const int RED = 1;
const int GREEN = 2;
const int BLUE = 3;
Create image rectangle with current image width/height
CGRect imageRect = CGRectMake(0, 0, self.size.width * self.scale, self.size.height * self.scale);
int width = imageRect.size.width;
int height = imageRect.size.height;
// the pixels will be painted to this array
uint32_t *pixels = (uint32_t *) malloc(width * height * sizeof(uint32_t));
// clear the pixels so any transparency is preserved
memset(pixels, 0, width * height * …Run Code Online (Sandbox Code Playgroud)