iOS--UISearchBar 屬性、方法詳解及應用(自定義搜索框樣式)

2020-11-29 舊事回首站

很多APP都會涉及到搜索框,蘋果也為我們提供了默認的搜索框UISearchBar。但實際項目中我們通常需要更改系統默認搜索框的樣式。為了實現這一目標,我們需要先搞懂 UISearchBar 的屬性及方法。在系統的掌握了這些基礎的前提下才能更好的去應用它,包括修改樣式、或者是模仿系統搜索框的樣式自定義一個自己的搜索框等。

本文主要介紹內容分為以下三個部分:

UISearchBar 的屬性

UISearchBar 的方法

自定義 UISearchBar 的樣式

1. UISearchBar 的屬性

介紹之前先說一下 UISearchBar 的初始化方法:UISearchBar 是 UIView 的子類,它的初始化方法有三種:

- (instancetype)init

- (instancetype)initWithFrame:(CGRect)frame

- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder

這三個初始化方法是我們常見的初始化 UIView 以及它的子類的方法,比較常見,而且也不是介紹重點,所以這裡不展開說明。

1.1 搜索框風格

屬性

// 搜索框風格

@property(nonatomic) UIBarStyle barStyle;

UIBarStyle 有四種枚舉值,但後兩種已經禁用。

typedef NS_ENUM(NSInteger, UIBarStyle) {

UIBarStyleDefault //白色搜索框,灰色背景

UIBarStyleBlack //黑色搜索框,

UIBarStyleBlackOpaque = 1, // 禁用. Use UIBarStyleBlack

UIBarStyleBlackTranslucent = 2, // 禁用. Use UIBarStyleBlack and set the translucent property to YES

}

效果圖:

UIBarStyleDefault 樣式

UIBarStyleBlack樣式

1.2 搜索的文本、搜索框頂部的提示信息、佔位符

屬性

// 搜索的文本

@property(nullable,nonatomic,copy) NSString *text;

// 搜索框頂部的提示信息

@property(nullable,nonatomic,copy) NSString *prompt;

// 佔位符,默認nil, 若有值則在輸入文本後消失

@property(nullable,nonatomic,copy) NSString *placeholder;

效果圖:

prompt 和 placeholder

輸入文本為 text 後 placeholder 消失

1.3 搜索框右側的按鈕

屬性

// 搜索框右側是否顯示圖書按鈕

@property(nonatomic) BOOL showsBookmarkButton;

//搜索框右側是否顯示取消按鈕

@property(nonatomic) BOOL showsCancelButton;

//搜索框右側是否顯示搜索結果按鈕

@property(nonatomic) BOOL showsSearchResultsButton;

// 搜索結果按鈕為選中狀態

@property(nonatomic, getter=isSearchResultsButtonSelected) BOOL searchResultsButtonSelected;

以上四個屬性的默認值都是 NO

效果圖:

showsBookmarkButton = YES 效果

showsCancelButton = YES 效果

showsSearchResultsButton = YES 效果

searchResultsButtonSelected = YES 效果,要結合showsSearchResultsButton = YES使用

1.4 風格顏色、背景顏色

屬性

// 風格顏色,可用於修改輸入框的光標顏色,取消按鈕和選擇欄被選中時候都會變成設置的顏色

@property(null_resettable, nonatomic,strong) UIColor *tintColor;

// 搜索框背景顏色

@property(nullable, nonatomic,strong) UIColor *barTintColor;

測試代碼

self.tintColor = [UIColor orangeColor]; //設置光標顏色為橘色

self.barTintColor = [UIColor grayColor]; //設置搜索框背景顏色為灰色

效果圖:

tintColor 和 barTintColor

1.5 搜索框樣式

屬性

// 搜索框樣式

@property (nonatomic) UISearchBarStyle searchBarStyle

它有三種枚舉值:

typedef NS_ENUM(NSUInteger, UISearchBarStyle) {

UISearchBarStyleDefault, // 默認樣式,和UISearchBarStyleProminent 一樣

UISearchBarStyleProminent, // 顯示背景,常用在my Mail, Messages and Contacts

UISearchBarStyleMinimal // 不顯示背景,系統自帶的背景色無效,自定義的有效,常用在Calendar, Notes and Music

}

效果圖:

UISearchBarStyleMinimal 不顯示背景

UISearchBarStyleDefault 和 UISearchBarStyleProminent 都顯示背景

1.6 搜索欄的附件選擇按鈕視圖

屬性

// 選擇按鈕試圖的按鈕標題

@property(nullable, nonatomic,copy) NSArray *scopeButtonTitles ;

// 選中的按鈕下標值 ,默認 0. 如果超出範圍則忽略

@property(nonatomic) NSInteger selectedScopeButtonIndex ;

// 是否顯示搜索欄的附件選擇按鈕視圖

@property(nonatomic) BOOL showsScopeBar;

測試代碼

self.placeholder = @"搜索";

self.showsScopeBar = YES;

self.scopeButtonTitles = @[@"One", @"Two", @"Three"];

self.selectedScopeButtonIndex = 1;

效果圖:

帶選擇按鈕視圖的搜索欄

1.7 搜索框背景圖片、搜索框附屬分欄條的背景顏色

屬性

// 搜索框背景圖片

@property(nullable, nonatomic,strong) UIImage *backgroundImage;

// 搜索框附屬分欄條的背景顏色

@property(nullable, nonatomic,strong) UIImage *scopeBarBackgroundImage;

測試代碼

//設置搜索框背景圖片

UIImage *backgroundImage = [UIImage imageNamed:@"image001"];

self.backgroundImage = backgroundImage;

//搜索框附屬分欄條的背景顏色

UIImage *scopeBarBackgroundImage = [UIImage imageNamed:@"image002"];

self.scopeBarBackgroundImage = scopeBarBackgroundImage;

效果圖:

設置backgroundImage 和 scopeBarBackgroundImage

1.8 索框中文本框的背景偏移量和文本偏移量

屬性

// 搜索框中文本框的背景偏移量

@property(nonatomic) UIOffset searchFieldBackgroundPositionAdjustment;

// 搜索框中文本框的文本偏移量

@property(nonatomic) UIOffset searchTextPositionAdjustment;

測試代碼

self.searchFieldBackgroundPositionAdjustment = UIOffsetMake(5, 3);

self.searchTextPositionAdjustment = UIOffsetMake(10, 5);

效果圖:

設置偏移量前後對比圖

PS: UITextInputAssistantItem *inputAssistantItem 、BOOL translucent 、UIView *inputAccessoryView 經過測試這三個屬性並不太清楚具體實現效果,之後會繼續深入了解一下,記在這裡,作為提醒,如果有誰剛好了解它們,希望能夠給與幫助,非常感謝。

2. UISearchBar 的方法

2.1 設置是否動畫效果的顯示或隱藏取消按鈕

方法:

// 設置是否動畫效果的顯示或隱藏取消按鈕

- (void)setShowsCancelButton:(BOOL)showsCancelButton animated:(BOOL)animated

通常在開始編輯文本時將調用該方法,讓取消按鈕顯示出來。

測試代碼:

-(void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {

NSLog(@"開始輸入搜索內容");

[searchBar setShowsCancelButton:YES animated:YES]; // 動畫顯示取消按鈕

}

效果圖:

setShowsCancelButton: animated:

2.2 設置 (獲取) 搜索框背景圖片、選擇按鈕視圖的背景圖片、文本框的背景圖片

方法:

// 1.設置搜索框背景圖片

- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics

// 獲取置搜索框背景圖片

- (nullable UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics

// 2.設置選擇按鈕視圖的背景圖片

- (void)setScopeBarButtonBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state

// 獲取選擇按鈕視圖的背景圖片

- (nullable UIImage *)scopeBarButtonBackgroundImageForState:(UIControlState)state

// 3.設置搜索框文本框的背景圖片

- (void)setSearchFieldBackgroundImage:(nullable UIImage *)backgroundImage forState:(UIControlState)state

// 獲取搜索框文本框的背景圖片

- (nullable UIImage *)searchFieldBackgroundImageForState:(UIControlState)state

測試代碼:

self.showsScopeBar = YES;

self.scopeButtonTitles = @[@"One", @"Two", @"Three"];

self.selectedScopeButtonIndex = 1;

// 設置搜索框背景圖片

[self setBackgroundImage:[UIImage imageNamed:@"image001"] forBarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];

// 設置選擇按鈕視圖的背景圖片

[self setScopeBarButtonBackgroundImage:[UIImage imageNamed:@"image002"] forState:UIControlStateNormal];

// 設置搜索框文本框的背景圖片

[self setSearchFieldBackgroundImage:[UIImage imageNamed:@"image003"] forState:UIControlStateNormal];

效果圖:

設置搜索框背景圖片、選擇按鈕視圖的背景圖片、文本框的背景圖片

我們可以觀察一下選擇按鈕視圖的背景圖片,發現這個圖片只是設置在三個按鈕的底部視圖,而大的外面的空餘背景依舊是灰色,對比1.7中使用屬性UIImage *scopeBarBackgroundImage 設置的背景圖片,發現使用屬性設置背景圖片不會有空餘的灰色背景,該屬性針對的是大的scopeBar, 而不是一個scopeBarButton,這一點需要注意區分。

2.3 設置(獲取)搜索框的圖標(包括搜索圖標、清除輸入的文字的圖標、圖書圖標、搜索結果列表圖標)

屬性

// 設置搜索框的圖標

- (void)setImage:(nullable UIImage *)iconImage forSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state;

// 獲取搜索框的圖標

- (nullable UIImage *)imageForSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state;

搜索框圖標 UISearchBarIcon 有四個枚舉值:

typedef NS_ENUM(NSInteger, UISearchBarIcon) {

UISearchBarIconSearch, // 搜索框放大鏡圖標

UISearchBarIconClear , // 搜索框右側可用於清除輸入的文字的圖標x

UISearchBarIconBookmark , // 搜索框右側的圖書圖標

UISearchBarIconResultsList , // 搜索框右側的搜索結果列表圖標

};

測試代碼

self.placeholder = @"搜索";

self.showsSearchResultsButton = YES;

// 設置搜索框放大鏡圖標

UIImage *searchIcon = [UIImage imageNamed:@"searchIcon"];

[self setImage:searchIcon forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];

// 設置搜索結果列表圖標

UIImage *resultListIcon = [UIImage imageNamed:@"arrow"];

[self setImage:resultListIcon forSearchBarIcon:UISearchBarIconResultsList state:UIControlStateNormal];

效果圖

重新設置搜索框搜索圖標和顯示結果列表的圖標

可以發現搜索圖標和搜索結果列表圖標已經改變,至於其他的兩個圖標仿照上面代碼修改即可實現。

2.4 設置(獲取)選擇按鈕視圖的分割線圖片、按鈕上顯示的標題樣式

方法

// 設置選擇按鈕視圖的分割線圖片

- (void)setScopeBarButtonDividerImage:(nullable UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState;

// 獲取選擇按鈕視圖的分割線圖片

- (nullable UIImage *)scopeBarButtonDividerImageForLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState;

// 設置選擇按鈕視圖的標題樣式

- (void)setScopeBarButtonTitleTextAttributes:(nullable NSDictionary *)attributes forState:(UIControlState)state;

// 獲取選擇按鈕視圖的標題樣式

- (nullable NSDictionary *)scopeBarButtonTitleTextAttributesForState:(UIControlState)state

測試代碼

self.showsScopeBar = YES;

self.scopeButtonTitles = @[@"One", @"Two", @"Three", @"Four"];

// 設置選擇按鈕視圖的分割線圖片為一個橘色的線條

[self setScopeBarButtonDividerImage:[UIImage imageNamed:@"divider"] forLeftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal];

// 設置選擇按鈕視圖的標題樣式為20號橘色空心的系統字體

NSDictionary *attributeDic = @{NSFontAttributeName : [UIFont systemFontOfSize:20] , NSStrokeColorAttributeName : [UIColor orangeColor] , NSStrokeWidthAttributeName : @(3)};

[self setScopeBarButtonTitleTextAttributes:attributeDic forState:UIControlStateNormal];

效果圖

設置選擇按鈕視圖的分割線圖片和按鈕上顯示的標題樣式的效果圖

2.5 設置(獲取)搜索框四種圖標的偏移量

(評論裡的小夥伴說不管怎樣運行搜索圖標總是在左邊,測試後發現在iOS11系統上搜索圖標默認在左邊,而我當時寫文章時沒有升級模擬器為iOS11,所以非常感謝她的評論,不然自己也沒注意到。總之就是如果想要更改搜索圖標的位置,可以使用這個方法哦,親測有效)

方法

// 設置搜索框圖標的偏移量

- (void)setPositionAdjustment:(UIOffset)adjustment forSearchBarIcon:(UISearchBarIcon)icon;

// 獲取搜索框圖標的偏移量

- (UIOffset)positionAdjustmentForSearchBarIcon:(UISearchBarIcon)icon;

測試代碼

self.placeholder = @"搜索";

[self setPositionAdjustment:UIOffsetMake(15, 5) forSearchBarIcon:UISearchBarIconSearch];

效果圖

設置搜索圖標向有偏移15個單位,向下偏移5個單位後的效果圖

2.6 UISearchBarDelegate代理方法

方法

// 1. 將要開始編輯文本時會調用該方法,返回 NO 將不會變成第一響應者

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar;

// 2. 開始輸入文本會調用該方法

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar;

// 3. 將要結束編輯文本時會調用該方法,返回 NO 將不會釋放第一響應者

- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar;

// 4. 結束編輯文本時調用該方法

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar;

// 5. 文本改變會調用該方法(包含clear文本)

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText;

// 6. 文字改變前會調用該方法,返回NO則不能加入新的編輯文字

- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text ;

// 7. 鍵盤上的搜索按鈕點擊的會調用該方法

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar;

// 8. 搜索框右側圖書按鈕點擊會調用該方法

- (void)searchBarBookmarkButtonClicked:(UISearchBar *)searchBar ;

// 9.點擊取消按鈕會調用該方法

- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar;

// 10.搜索結果列表按鈕被按下會調用該方法

- (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar ;

// 11. 搜索框的附屬按鈕視圖中切換按鈕會調用該方法

- (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope;

測試代碼

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {

return YES;

}

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {

searchBar.prompt = @"1.開始編輯文本";

[searchBar setShowsCancelButton:YES animated:YES]; // 動畫效果顯示取消按鈕

}

- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text {

return YES;

}

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {

searchBar.prompt = @"2.在改變文本過程中。。。";

}

- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar {

searchBar.prompt = @"3. 點擊鍵盤上的搜索按鈕";

}

- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {

searchBar.prompt = @"4. 點擊取消按鈕";

searchBar.text = @"";

[self setShowsCancelButton:NO animated:YES];

// 如果希望在點擊取消按鈕調用結束編輯方法需要讓加上這句代碼

//[searchBar resignFirstResponder];

}

- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar{

return YES;

}

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {

searchBar.prompt = @"5.已經結束編輯文本";

}

效果圖

點擊取消按鈕但沒有釋放搜索框的第一響應者身份效果圖:

gif1

點擊取消按鈕用時釋放搜索框的第一響應者身份會調用結束編輯文本的方法:

gif2

3. 自定義 UISearchBar 的樣式

在自定義UISearchBar 樣式之前我們先來看一下UISearchBar的組成:

UISearchBar層次結構截圖

根據這個截圖我們可以概括為下圖:

簡單概括的UISearchBar層次結構

根據這個簡單的層次結構圖,我們可以更好的了解UISearchBar的組成部分,這樣有助於我們更方便的進行自定義樣式,下面開始自定義樣式!

目標搜索框樣式

首先看一下目標樣式

目標搜索框樣式.gif

實現代碼

代碼中添加約束和自定義顏色可參考之前寫的兩篇文章:約束和自定義顏色

// 委託

- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar {

[searchBar setShowsCancelButton:YES animated:YES];

}

- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar {

searchBar.text = @"";

[self setShowsCancelButton:NO animated:YES];

[searchBar resignFirstResponder];

}

- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {

self.voiceButton.hidden = searchText.length > 0 ? YES : NO;

}

- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar {

self.voiceButton.hidden = NO;

}

// 樣式設計

- (void)modifyStyleByTraversal {

// 修改搜索框背景圖片為自定義的灰色

UIColor *backgroundImageColor = [UIColor colorwithHex:0xE3DFDA];

UIImage* clearImg = [self imageWithColor:backgroundImageColor andHeight:45.0];

self.backgroundImage = clearImg;

// 修改搜索框光標顏色

self.tintColor = [UIColor P2Color];

// 修改搜索框的搜索圖標

[self setImage:[UIImage imageNamed:@"searchIcon"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];

for (UIView *view in self.subviews.lastObject.subviews) {

if([view isKindOfClass:NSClassFromString(@"UISearchBarTextField")]) {

UITextField *textField = (UITextField *)view;

//添加話筒按鈕

[self addVoiceButton:textField];

//設置輸入框的背景顏色

textField.clipsToBounds = YES;

textField.backgroundColor = [UIColor P1Color];

//設置輸入框邊框的圓角以及顏色

textField.layer.cornerRadius = 10.0f;

textField.layer.borderColor = [UIColor P2Color].CGColor;

textField.layer.borderWidth = 1;

//設置輸入字體顏色

textField.textColor = [UIColor P2Color];

//設置默認文字顏色

textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@" 搜索" attributes:@{NSForegroundColorAttributeName:[UIColor P2Color]}];

}

if ([view isKindOfClass:NSClassFromString(@"UINavigationButton")]) {

UIButton *cancel = (UIButton *)view;

[cancel setTitle:@"取消" forState:UIControlStateNormal];

[cancel setTitleColor:[UIColor P2Color] forState:UIControlStateNormal];

}

}

}

// 畫指定高度和顏色的圖片

- (UIImage*) imageWithColor:(UIColor*)color andHeight:(CGFloat)height {

CGRect rect = CGRectMake(0.0, 0.0, 1.0, height);

UIGraphicsBeginImageContext(rect.size);

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextSetFillColorWithColor(context, [color CGColor]);

CGContextFillRect(context, rect);

UIImage *image = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return image;

}

// 添加話筒按鈕

- (void)addVoiceButton:(UIView *)view {

if (!self.voiceButton) {

self.voiceButton = [UIButton buttonWithType:UIButtonTypeCustom];

}

[self.voiceButton setImage:[UIImage imageNamed:@"voice"] forState:UIControlStateNormal];

[self.voiceButton addTarget:self action:@selector(say) forControlEvents:UIControlEventTouchUpInside];

[view addSubview:self.voiceButton];

self.voiceButton.translatesAutoresizingMaskIntoConstraints = NO;

[self.voiceButton addWidthConstraint:15];

[self.voiceButton addHeightConstraint:15];

[self.voiceButton addTopConstraintToView:view constant:8];

[self.voiceButton addTrailingConstraintToView:view constant:- 15];

}

// 點擊話筒觸發該方法

- (void)say {

// self.prompt = @"在講話哦!";

}

補充:修改UISearchBar寬高

UISearchBar 有默認的布局樣式,我們想要修改他的寬高,需要重寫layoutSubviews 方法。然後在這個方法裡面修改UISearchBarTextField的寬高。

實現代碼

- (void)layoutSubviews {

[super layoutSubviews];

UITextField *textField = [self valueForKey:@"searchBarTextField"];

if (textField) {

textField.frame = CGRectMake(50, 10, self.bounds.size.width - 100, 35);

}

}

效果圖:

自定義搜索框的寬高

作者:遇見0620

連結:https://www.jianshu.com/p/7e49a1c656e7

相關焦點

  • 使用HTML DIV+CSS樣式+JavaScript實現自定義個性化的模態窗口
    圖1圖1就是一個使用DIV+CSS自定義的一個模態窗口,其優點是個性化強,根據系統要求完全自行設計,而系統窗口是無法做到的。,position屬性主要用來設置元素的定位。如果要使一個DIV相對於整個瀏覽器定位,並且是全屏顯示,帶背景色,則可以設置如下CSS樣式:<!
  • word中快速應用表格樣式及表格樣式的修改——想像力電腦應用
    在word 2013軟體中,提供了豐富的表格樣式庫,對於不經常操作表格或者是對表格的參數設置不是太熟練的初學都,我們可以利用「表格樣式庫」功能快速的製作出美觀的表格文檔;如果樣式不能很好的滿足我們的應用要求,我們也可以進行自定義設置表格的樣式。
  • Matplotlib繪圖|快速定義圖表樣式的小技巧
    (X,S,color = "blue",linewidth = 3.0,linestyle = ":")為了方便起見,matplotlib 提供一個 matplotlibrc 文件接口,來全局自定義圖表屬性(圖表大小、DPI、線的寬度、坐標軸、樣式、網格屬性等),使用方法為 rcParams 命令,一次定義,對接下來創建的全部圖表的樣式都起效,避免了來回調參的麻煩rcParsms
  • 《怪物獵人世界》武器怎樣自定義升級 武器自定義升級系統詳解
    導 讀 怪物獵人世界武器自定義升級系統怎麼用?
  • RobotStudio軟體:機器人自定義行走軸配置與仿真
    這個時候就需要自定義設計機器人行走軸,對機器人生產線進行仿真時就同樣需要使用自定義設計的行走軸。RobotStudio軟體除了能夠使用自帶模型庫中的行走軸仿真以外,也支持用戶自定義設計的行走軸仿真。本期,就來為大家介紹一下使用自定義設計模型創建機器人行走軸,並實現仿真運行。
  • ios10.3耗電嗎 ios10.3耗電情況和省電攻略【詳解】
    最近,不少網友都在關注蘋果的最新作業系統:ios10.3。其中,一些網友想知道:ios10.3耗電嗎?在今天的教程中,我們就來聊一下ios10.3耗電情況。同時,也給大家分享一些ios10.3系統的省電攻略,希望大家會喜歡!
  • SolidWorks—Attribute屬性的應用
    Attribute是Solidworks提供的一種文件級屬性,不同於「自定義屬性」和「配置特定屬性」的CoustomProrertyManager。使用場景:相信很多二次開發初學者均在書本見過Attribute屬性的使用方法,但是在平時的二次開發中卻幾乎從不使用,例如批量操作插件開發。那麼問題來了,做什麼功能開發時需要使用到呢?
  • 雷柏V500機械遊戲鍵盤驅動功能及宏定義設置詳解
    需要說明的是,無論進行任何設置的調整與改變,需要點擊界面下方的「應用」選項框,設置才會生效。點擊界面上任意一個按鍵,會彈出一個按鍵設置面板,這個面板就是V500單個按鍵可以自定義的範圍與項目,自定義選項框中包含「單鍵/組合鍵」「宏定義」「基本功能」「多媒體」「滑鼠」5個項目。點擊單鍵/組合鍵選項,在該選項框內可以將某一鍵盤按鍵設置為任意一組組合鍵,或某個鍵盤上的單鍵。
  • 手機軟體圖標自定義,可以設置個性化微信logo!簡單又好看!
    扣肉發現微信的logo可以自定義,可以切換成你喜歡的圖標樣式,連名字都可以更改。超簡單,一鍵設置。1、 首先打開這個工具,選擇想更改圖標的應用,點擊上方輸入框填寫自定義名稱。進入,點擊第二個框找到【WeChat】。2、 再點擊【type a valid icon URL】,在手機裡選擇一張照片,照片選擇完成,點擊綠色的【Let' GO!】
  • 機器學習在搜索中的應用:個性化排序
    編輯導語:隨著科技的發展,AI、機器學習等逐漸出現在我們的生活裡,有了這些的出現,我們進行搜索時會變得更加準確和智能;本文作者詳細介紹了機器學習在搜索中的應用,我們一起來看一下。AI、機器學習,是現在媒體的高頻曝光詞,市面上的很多應用都逐漸接入了AI的能力;搜索這樣的『古董』級產品,其實也是應用機器學習技術的先驅。本次從搜索的一個場景——搜索結果排序,來聊聊機器學習在搜索產品中的應用。
  • CAXA CAPP教程:用戶自定義知識庫
    之前跟大家介紹了CAXA工藝圖表的工藝知識庫分為系統知識庫和用戶自定義知識庫,在這一講中,我們將詳細介紹用戶自定義知識庫的常用操作。使用自定義知識庫,可以更加靈活的定義所需的各類知識庫,右擊自定義資料庫中的某個節點,彈出右鍵菜單,如圖一所示,利用快捷菜單中的命令,可以方便地完成自定義資料庫結構的創建。
  • 三維CAD功能教程:強化材料屬性工具輕鬆自定義
    一、製作零件材料屬性從工具選項卡進入「零件屬性」選項,彈出零件屬性彈窗,如圖1所示,點擊材料庫圖標,彈出材料屬性彈窗,從文件/束中選擇材料或者自定義材料名稱和密度,並點擊確定,這樣即完成了零件材料屬性製作
  • 谷歌推出彩色搜索框彩蛋
    同性戀自豪日在即,谷歌又推出了彩色搜索框彩蛋以示支持。目前,只要在谷歌搜索與同性戀有關的詞彙,如gay、lgbt、lesbian、transgender等等時,則搜索框會出現彩色彩虹立體特效。谷歌彩色搜索框支持同性戀自豪日  據悉,谷歌從2009年開始就會在每年的6月推出七色彩虹搜索彩蛋以示對同性戀的支持,今年也不例外。不同於2012年在搜索框底部出現起色彩虹半圓花邊圖案。
  • 微軟詳解 Word2013 新風格功能:樣式隨心變
    9月8日消息,微軟本周更新了Word官方博客,詳解了Word 2013中的新風格選項。這篇博文介紹了Word 2013的新功能:統一設計選項卡。微軟稱:「這個選項卡中包含了改變文檔整體風格的所有功能(您無需進行選擇)。
  • 大文檔多如垃圾的Word樣式,如何清理刪除
    以下代碼來自網絡(請百度「在移除 Word 文檔樣式的同時保留格式 - 少數派」),作者是PlatyHsu,我為代碼作了一些注釋。代碼的邏輯是遍歷文檔段落,分別獲得該段落的樣式的所有字體格式和所有段落格式,然後把段落樣式設置為「正文」,最後把之前獲得的字體和段落格式再應用到該段落上。
  • 《傳奇盛世》稱號盛世雄霸者屬性詳解 盛世雄霸者獲取方法
    今天小編給大家帶來的就是其中的稱號——盛世雄霸者的屬性詳解,感興趣的玩家不妨來看一下。小編在這裡不光會介紹增加的屬性,還會羅列出通過時裝獲得的屬性總加成情況,咱們一起來看下吧。 通過時裝已獲—— 屬性總加成:攻擊:4160-5740,物理防禦:1810-2390,魔法防禦:1810-2390,經驗加成:100%,生命:10400,PK傷害:23%,PK免傷:23%,閃避:4。 增加屬性:無。
  • 華為主題-浮光躍金 超強自定義-玩家必讀
    浮光躍金 超強自定義 主題相關功能介紹視頻如下:浮光躍金 超強自定義 主題預覽圖如下:
  • 泰拉瑞亞巨臉怪寶寶獲取方法和屬性詳解
    小編給大家帶來了泰拉瑞亞巨臉怪寶寶獲取方法和屬性詳解,想了解更多Terraria《泰拉瑞亞》攻略,敬請關注18183泰拉瑞亞專區。